github.com/newrelic/newrelic-client-go@v1.1.0/pkg/entities/entities_api.go (about) 1 // Code generated by tutone: DO NOT EDIT 2 package entities 3 4 import ( 5 "context" 6 7 "github.com/newrelic/newrelic-client-go/pkg/common" 8 "github.com/newrelic/newrelic-client-go/pkg/errors" 9 ) 10 11 // Adds the provided tags to your specified entity, without deleting existing ones. 12 // The maximum number of tag-values per entity is 100; if the sum of existing and new tag-values if over the limit this mutation will fail. 13 // 14 // For details and mutation examples, visit [our docs](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-tagging-api-tutorial). 15 func (a *Entities) TaggingAddTagsToEntity( 16 gUID common.EntityGUID, 17 tags []TaggingTagInput, 18 ) (*TaggingMutationResult, error) { 19 return a.TaggingAddTagsToEntityWithContext(context.Background(), 20 gUID, 21 tags, 22 ) 23 } 24 25 // Adds the provided tags to your specified entity, without deleting existing ones. 26 // The maximum number of tag-values per entity is 100; if the sum of existing and new tag-values if over the limit this mutation will fail. 27 // 28 // For details and mutation examples, visit [our docs](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-tagging-api-tutorial). 29 func (a *Entities) TaggingAddTagsToEntityWithContext( 30 ctx context.Context, 31 gUID common.EntityGUID, 32 tags []TaggingTagInput, 33 ) (*TaggingMutationResult, error) { 34 35 resp := TaggingAddTagsToEntityQueryResponse{} 36 vars := map[string]interface{}{ 37 "guid": gUID, 38 "tags": tags, 39 } 40 41 if err := a.client.NerdGraphQueryWithContext(ctx, TaggingAddTagsToEntityMutation, vars, &resp); err != nil { 42 return nil, err 43 } 44 45 return &resp.TaggingMutationResult, nil 46 } 47 48 type TaggingAddTagsToEntityQueryResponse struct { 49 TaggingMutationResult TaggingMutationResult `json:"TaggingAddTagsToEntity"` 50 } 51 52 const TaggingAddTagsToEntityMutation = `mutation( 53 $guid: EntityGuid!, 54 $tags: [TaggingTagInput!]!, 55 ) { taggingAddTagsToEntity( 56 guid: $guid, 57 tags: $tags, 58 ) { 59 errors { 60 message 61 type 62 } 63 } }` 64 65 // Delete specific tag keys from the entity. 66 // 67 // For details and mutation examples, visit [our docs](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-tagging-api-tutorial). 68 func (a *Entities) TaggingDeleteTagFromEntity( 69 gUID common.EntityGUID, 70 tagKeys []string, 71 ) (*TaggingMutationResult, error) { 72 return a.TaggingDeleteTagFromEntityWithContext(context.Background(), 73 gUID, 74 tagKeys, 75 ) 76 } 77 78 // Delete specific tag keys from the entity. 79 // 80 // For details and mutation examples, visit [our docs](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-tagging-api-tutorial). 81 func (a *Entities) TaggingDeleteTagFromEntityWithContext( 82 ctx context.Context, 83 gUID common.EntityGUID, 84 tagKeys []string, 85 ) (*TaggingMutationResult, error) { 86 87 resp := TaggingDeleteTagFromEntityQueryResponse{} 88 vars := map[string]interface{}{ 89 "guid": gUID, 90 "tagKeys": tagKeys, 91 } 92 93 if err := a.client.NerdGraphQueryWithContext(ctx, TaggingDeleteTagFromEntityMutation, vars, &resp); err != nil { 94 return nil, err 95 } 96 97 return &resp.TaggingMutationResult, nil 98 } 99 100 type TaggingDeleteTagFromEntityQueryResponse struct { 101 TaggingMutationResult TaggingMutationResult `json:"TaggingDeleteTagFromEntity"` 102 } 103 104 const TaggingDeleteTagFromEntityMutation = `mutation( 105 $guid: EntityGuid!, 106 $tagKeys: [String!]!, 107 ) { taggingDeleteTagFromEntity( 108 guid: $guid, 109 tagKeys: $tagKeys, 110 ) { 111 errors { 112 message 113 type 114 } 115 } }` 116 117 // Delete specific tag key-values from the entity. 118 // 119 // For details and mutation examples, visit [our docs](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-tagging-api-tutorial). 120 func (a *Entities) TaggingDeleteTagValuesFromEntity( 121 gUID common.EntityGUID, 122 tagValues []TaggingTagValueInput, 123 ) (*TaggingMutationResult, error) { 124 return a.TaggingDeleteTagValuesFromEntityWithContext(context.Background(), 125 gUID, 126 tagValues, 127 ) 128 } 129 130 // Delete specific tag key-values from the entity. 131 // 132 // For details and mutation examples, visit [our docs](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-tagging-api-tutorial). 133 func (a *Entities) TaggingDeleteTagValuesFromEntityWithContext( 134 ctx context.Context, 135 gUID common.EntityGUID, 136 tagValues []TaggingTagValueInput, 137 ) (*TaggingMutationResult, error) { 138 139 resp := TaggingDeleteTagValuesFromEntityQueryResponse{} 140 vars := map[string]interface{}{ 141 "guid": gUID, 142 "tagValues": tagValues, 143 } 144 145 if err := a.client.NerdGraphQueryWithContext(ctx, TaggingDeleteTagValuesFromEntityMutation, vars, &resp); err != nil { 146 return nil, err 147 } 148 149 return &resp.TaggingMutationResult, nil 150 } 151 152 type TaggingDeleteTagValuesFromEntityQueryResponse struct { 153 TaggingMutationResult TaggingMutationResult `json:"TaggingDeleteTagValuesFromEntity"` 154 } 155 156 const TaggingDeleteTagValuesFromEntityMutation = `mutation( 157 $guid: EntityGuid!, 158 $tagValues: [TaggingTagValueInput!]!, 159 ) { taggingDeleteTagValuesFromEntity( 160 guid: $guid, 161 tagValues: $tagValues, 162 ) { 163 errors { 164 message 165 type 166 } 167 } }` 168 169 // Replaces the entity's entire set of tags with the provided tag set. 170 // The maximum number of tag-values per entity is 100; if more than 100 tag-values are provided this mutation will fail. 171 // 172 // For details and mutation examples, visit [our docs](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-tagging-api-tutorial). 173 func (a *Entities) TaggingReplaceTagsOnEntity( 174 gUID common.EntityGUID, 175 tags []TaggingTagInput, 176 ) (*TaggingMutationResult, error) { 177 return a.TaggingReplaceTagsOnEntityWithContext(context.Background(), 178 gUID, 179 tags, 180 ) 181 } 182 183 // Replaces the entity's entire set of tags with the provided tag set. 184 // The maximum number of tag-values per entity is 100; if more than 100 tag-values are provided this mutation will fail. 185 // 186 // For details and mutation examples, visit [our docs](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-tagging-api-tutorial). 187 func (a *Entities) TaggingReplaceTagsOnEntityWithContext( 188 ctx context.Context, 189 gUID common.EntityGUID, 190 tags []TaggingTagInput, 191 ) (*TaggingMutationResult, error) { 192 193 resp := TaggingReplaceTagsOnEntityQueryResponse{} 194 vars := map[string]interface{}{ 195 "guid": gUID, 196 "tags": tags, 197 } 198 199 if err := a.client.NerdGraphQueryWithContext(ctx, TaggingReplaceTagsOnEntityMutation, vars, &resp); err != nil { 200 return nil, err 201 } 202 203 return &resp.TaggingMutationResult, nil 204 } 205 206 type TaggingReplaceTagsOnEntityQueryResponse struct { 207 TaggingMutationResult TaggingMutationResult `json:"TaggingReplaceTagsOnEntity"` 208 } 209 210 const TaggingReplaceTagsOnEntityMutation = `mutation( 211 $guid: EntityGuid!, 212 $tags: [TaggingTagInput!]!, 213 ) { taggingReplaceTagsOnEntity( 214 guid: $guid, 215 tags: $tags, 216 ) { 217 errors { 218 message 219 type 220 } 221 } }` 222 223 // Fetch a list of entities. 224 // 225 // You can fetch a max of 25 entities in one query. 226 // 227 // For more details on entities, visit our [entity docs](https://docs.newrelic.com/docs/apis/graphql-api/tutorials/use-new-relic-graphql-api-query-entities). 228 func (a *Entities) GetEntities( 229 gUIDs []common.EntityGUID, 230 ) (*[]EntityInterface, error) { 231 return a.GetEntitiesWithContext(context.Background(), 232 gUIDs, 233 ) 234 } 235 236 // Fetch a list of entities. 237 // 238 // You can fetch a max of 25 entities in one query. 239 // 240 // For more details on entities, visit our [entity docs](https://docs.newrelic.com/docs/apis/graphql-api/tutorials/use-new-relic-graphql-api-query-entities). 241 func (a *Entities) GetEntitiesWithContext( 242 ctx context.Context, 243 gUIDs []common.EntityGUID, 244 ) (*[]EntityInterface, error) { 245 246 resp := entitiesResponse{} 247 vars := map[string]interface{}{ 248 "guids": gUIDs, 249 } 250 251 if err := a.client.NerdGraphQueryWithContext(ctx, getEntitiesQuery, vars, &resp); err != nil { 252 return nil, err 253 } 254 255 if len(resp.Actor.Entities) == 0 { 256 return nil, errors.NewNotFound("") 257 } 258 259 return &resp.Actor.Entities, nil 260 } 261 262 const getEntitiesQuery = `query( 263 $guids: [EntityGuid]!, 264 ) { actor { entities( 265 guids: $guids, 266 ) { 267 account { 268 id 269 name 270 reportingEventTypes 271 } 272 accountId 273 alertSeverity 274 domain 275 entityType 276 goldenMetrics { 277 context { 278 account 279 guid 280 } 281 metrics { 282 name 283 query 284 title 285 } 286 } 287 goldenTags { 288 context { 289 account 290 guid 291 } 292 tags { 293 key 294 } 295 } 296 guid 297 indexedAt 298 name 299 permalink 300 recentAlertViolations { 301 agentUrl 302 alertSeverity 303 closedAt 304 label 305 level 306 openedAt 307 violationId 308 violationUrl 309 } 310 relatedEntities { 311 nextCursor 312 results { 313 __typename 314 createdAt 315 type 316 ... on EntityRelationshipDetectedEdge { 317 __typename 318 } 319 ... on EntityRelationshipUserDefinedEdge { 320 __typename 321 } 322 } 323 } 324 relationships { 325 source { 326 accountId 327 entityType 328 guid 329 } 330 target { 331 accountId 332 entityType 333 guid 334 } 335 type 336 } 337 reporting 338 serviceLevel { 339 indicators { 340 createdAt 341 description 342 entityGuid 343 id 344 name 345 updatedAt 346 } 347 } 348 tags { 349 key 350 values 351 } 352 tagsWithMetadata { 353 key 354 values { 355 mutable 356 value 357 } 358 } 359 type 360 ... on ApmApplicationEntity { 361 __typename 362 account { 363 id 364 name 365 reportingEventTypes 366 } 367 apmBrowserSummary { 368 ajaxRequestThroughput 369 ajaxResponseTimeAverage 370 jsErrorRate 371 pageLoadThroughput 372 pageLoadTimeAverage 373 } 374 apmSummary { 375 apdexScore 376 errorRate 377 hostCount 378 instanceCount 379 nonWebResponseTimeAverage 380 nonWebThroughput 381 responseTimeAverage 382 throughput 383 webResponseTimeAverage 384 webThroughput 385 } 386 applicationId 387 deployments { 388 changelog 389 description 390 permalink 391 revision 392 timestamp 393 user 394 } 395 language 396 metricNormalizationRules { 397 action 398 applicationGuid 399 applicationName 400 createdAt 401 enabled 402 id 403 matchExpression 404 notes 405 replacement 406 } 407 recentAlertViolations { 408 agentUrl 409 alertSeverity 410 closedAt 411 label 412 level 413 openedAt 414 violationId 415 violationUrl 416 } 417 relatedEntities { 418 nextCursor 419 } 420 relationships { 421 type 422 } 423 runningAgentVersions { 424 maxVersion 425 minVersion 426 } 427 settings { 428 apdexTarget 429 serverSideConfig 430 } 431 tags { 432 key 433 values 434 } 435 tagsWithMetadata { 436 key 437 } 438 } 439 ... on ApmDatabaseInstanceEntity { 440 __typename 441 account { 442 id 443 name 444 reportingEventTypes 445 } 446 host 447 portOrPath 448 recentAlertViolations { 449 agentUrl 450 alertSeverity 451 closedAt 452 label 453 level 454 openedAt 455 violationId 456 violationUrl 457 } 458 relatedEntities { 459 nextCursor 460 } 461 relationships { 462 type 463 } 464 tags { 465 key 466 values 467 } 468 tagsWithMetadata { 469 key 470 } 471 vendor 472 } 473 ... on ApmExternalServiceEntity { 474 __typename 475 account { 476 id 477 name 478 reportingEventTypes 479 } 480 externalSummary { 481 responseTimeAverage 482 throughput 483 } 484 host 485 recentAlertViolations { 486 agentUrl 487 alertSeverity 488 closedAt 489 label 490 level 491 openedAt 492 violationId 493 violationUrl 494 } 495 relatedEntities { 496 nextCursor 497 } 498 relationships { 499 type 500 } 501 tags { 502 key 503 values 504 } 505 tagsWithMetadata { 506 key 507 } 508 } 509 ... on BrowserApplicationEntity { 510 __typename 511 account { 512 id 513 name 514 reportingEventTypes 515 } 516 agentInstallType 517 applicationId 518 browserSummary { 519 ajaxRequestThroughput 520 ajaxResponseTimeAverage 521 jsErrorRate 522 pageLoadThroughput 523 pageLoadTimeAverage 524 pageLoadTimeMedian 525 spaResponseTimeAverage 526 spaResponseTimeMedian 527 } 528 metricNormalizationRules { 529 action 530 applicationGuid 531 applicationName 532 createdAt 533 enabled 534 id 535 matchExpression 536 notes 537 replacement 538 } 539 recentAlertViolations { 540 agentUrl 541 alertSeverity 542 closedAt 543 label 544 level 545 openedAt 546 violationId 547 violationUrl 548 } 549 relatedEntities { 550 nextCursor 551 } 552 relationships { 553 type 554 } 555 runningAgentVersions { 556 maxVersion 557 minVersion 558 } 559 servingApmApplicationId 560 settings { 561 apdexTarget 562 } 563 tags { 564 key 565 values 566 } 567 tagsWithMetadata { 568 key 569 } 570 } 571 ... on DashboardEntity { 572 __typename 573 account { 574 id 575 name 576 reportingEventTypes 577 } 578 createdAt 579 dashboardParentGuid 580 description 581 owner { 582 email 583 userId 584 } 585 pages { 586 createdAt 587 description 588 guid 589 name 590 updatedAt 591 } 592 permissions 593 recentAlertViolations { 594 agentUrl 595 alertSeverity 596 closedAt 597 label 598 level 599 openedAt 600 violationId 601 violationUrl 602 } 603 relatedEntities { 604 nextCursor 605 } 606 relationships { 607 type 608 } 609 tags { 610 key 611 values 612 } 613 tagsWithMetadata { 614 key 615 } 616 updatedAt 617 } 618 ... on ExternalEntity { 619 __typename 620 account { 621 id 622 name 623 reportingEventTypes 624 } 625 recentAlertViolations { 626 agentUrl 627 alertSeverity 628 closedAt 629 label 630 level 631 openedAt 632 violationId 633 violationUrl 634 } 635 relatedEntities { 636 nextCursor 637 } 638 relationships { 639 type 640 } 641 tags { 642 key 643 values 644 } 645 tagsWithMetadata { 646 key 647 } 648 } 649 ... on GenericEntity { 650 __typename 651 account { 652 id 653 name 654 reportingEventTypes 655 } 656 recentAlertViolations { 657 agentUrl 658 alertSeverity 659 closedAt 660 label 661 level 662 openedAt 663 violationId 664 violationUrl 665 } 666 relatedEntities { 667 nextCursor 668 } 669 relationships { 670 type 671 } 672 tags { 673 key 674 values 675 } 676 tagsWithMetadata { 677 key 678 } 679 } 680 ... on GenericInfrastructureEntity { 681 __typename 682 account { 683 id 684 name 685 reportingEventTypes 686 } 687 integrationTypeCode 688 recentAlertViolations { 689 agentUrl 690 alertSeverity 691 closedAt 692 label 693 level 694 openedAt 695 violationId 696 violationUrl 697 } 698 relatedEntities { 699 nextCursor 700 } 701 relationships { 702 type 703 } 704 tags { 705 key 706 values 707 } 708 tagsWithMetadata { 709 key 710 } 711 } 712 ... on InfrastructureAwsLambdaFunctionEntity { 713 __typename 714 account { 715 id 716 name 717 reportingEventTypes 718 } 719 integrationTypeCode 720 recentAlertViolations { 721 agentUrl 722 alertSeverity 723 closedAt 724 label 725 level 726 openedAt 727 violationId 728 violationUrl 729 } 730 relatedEntities { 731 nextCursor 732 } 733 relationships { 734 type 735 } 736 runtime 737 tags { 738 key 739 values 740 } 741 tagsWithMetadata { 742 key 743 } 744 } 745 ... on InfrastructureHostEntity { 746 __typename 747 account { 748 id 749 name 750 reportingEventTypes 751 } 752 hostSummary { 753 cpuUtilizationPercent 754 diskUsedPercent 755 memoryUsedPercent 756 networkReceiveRate 757 networkTransmitRate 758 servicesCount 759 } 760 recentAlertViolations { 761 agentUrl 762 alertSeverity 763 closedAt 764 label 765 level 766 openedAt 767 violationId 768 violationUrl 769 } 770 relatedEntities { 771 nextCursor 772 } 773 relationships { 774 type 775 } 776 tags { 777 key 778 values 779 } 780 tagsWithMetadata { 781 key 782 } 783 } 784 ... on MobileApplicationEntity { 785 __typename 786 account { 787 id 788 name 789 reportingEventTypes 790 } 791 applicationId 792 metricNormalizationRules { 793 action 794 applicationGuid 795 applicationName 796 createdAt 797 enabled 798 id 799 matchExpression 800 notes 801 replacement 802 } 803 mobileSummary { 804 appLaunchCount 805 crashCount 806 crashRate 807 httpErrorRate 808 httpRequestCount 809 httpRequestRate 810 httpResponseTimeAverage 811 mobileSessionCount 812 networkFailureRate 813 usersAffectedCount 814 } 815 recentAlertViolations { 816 agentUrl 817 alertSeverity 818 closedAt 819 label 820 level 821 openedAt 822 violationId 823 violationUrl 824 } 825 relatedEntities { 826 nextCursor 827 } 828 relationships { 829 type 830 } 831 tags { 832 key 833 values 834 } 835 tagsWithMetadata { 836 key 837 } 838 } 839 ... on SecureCredentialEntity { 840 __typename 841 account { 842 id 843 name 844 reportingEventTypes 845 } 846 description 847 recentAlertViolations { 848 agentUrl 849 alertSeverity 850 closedAt 851 label 852 level 853 openedAt 854 violationId 855 violationUrl 856 } 857 relatedEntities { 858 nextCursor 859 } 860 relationships { 861 type 862 } 863 secureCredentialId 864 secureCredentialSummary { 865 failingMonitorCount 866 monitorCount 867 } 868 tags { 869 key 870 values 871 } 872 tagsWithMetadata { 873 key 874 } 875 updatedAt 876 } 877 ... on SyntheticMonitorEntity { 878 __typename 879 account { 880 id 881 name 882 reportingEventTypes 883 } 884 monitorId 885 monitorSummary { 886 locationsFailing 887 locationsRunning 888 status 889 successRate 890 } 891 monitorType 892 monitoredUrl 893 period 894 recentAlertViolations { 895 agentUrl 896 alertSeverity 897 closedAt 898 label 899 level 900 openedAt 901 violationId 902 violationUrl 903 } 904 relatedEntities { 905 nextCursor 906 } 907 relationships { 908 type 909 } 910 tags { 911 key 912 values 913 } 914 tagsWithMetadata { 915 key 916 } 917 } 918 ... on ThirdPartyServiceEntity { 919 __typename 920 account { 921 id 922 name 923 reportingEventTypes 924 } 925 recentAlertViolations { 926 agentUrl 927 alertSeverity 928 closedAt 929 label 930 level 931 openedAt 932 violationId 933 violationUrl 934 } 935 relatedEntities { 936 nextCursor 937 } 938 relationships { 939 type 940 } 941 tags { 942 key 943 values 944 } 945 tagsWithMetadata { 946 key 947 } 948 } 949 ... on UnavailableEntity { 950 __typename 951 account { 952 id 953 name 954 reportingEventTypes 955 } 956 recentAlertViolations { 957 agentUrl 958 alertSeverity 959 closedAt 960 label 961 level 962 openedAt 963 violationId 964 violationUrl 965 } 966 relatedEntities { 967 nextCursor 968 } 969 relationships { 970 type 971 } 972 tags { 973 key 974 values 975 } 976 tagsWithMetadata { 977 key 978 } 979 } 980 ... on WorkloadEntity { 981 __typename 982 account { 983 id 984 name 985 reportingEventTypes 986 } 987 createdAt 988 createdByUser { 989 email 990 gravatar 991 id 992 name 993 } 994 recentAlertViolations { 995 agentUrl 996 alertSeverity 997 closedAt 998 label 999 level 1000 openedAt 1001 violationId 1002 violationUrl 1003 } 1004 relatedEntities { 1005 nextCursor 1006 } 1007 relationships { 1008 type 1009 } 1010 tags { 1011 key 1012 values 1013 } 1014 tagsWithMetadata { 1015 key 1016 } 1017 updatedAt 1018 workloadStatus { 1019 description 1020 statusSource 1021 statusValue 1022 summary 1023 } 1024 } 1025 } } }` 1026 1027 // Fetch a single entity. 1028 // 1029 // For more details on entities, visit our [entity docs](https://docs.newrelic.com/docs/apis/graphql-api/tutorials/use-new-relic-graphql-api-query-entities). 1030 func (a *Entities) GetEntity( 1031 gUID common.EntityGUID, 1032 ) (*EntityInterface, error) { 1033 return a.GetEntityWithContext(context.Background(), 1034 gUID, 1035 ) 1036 } 1037 1038 // Fetch a single entity. 1039 // 1040 // For more details on entities, visit our [entity docs](https://docs.newrelic.com/docs/apis/graphql-api/tutorials/use-new-relic-graphql-api-query-entities). 1041 func (a *Entities) GetEntityWithContext( 1042 ctx context.Context, 1043 gUID common.EntityGUID, 1044 ) (*EntityInterface, error) { 1045 1046 resp := entityResponse{} 1047 vars := map[string]interface{}{ 1048 "guid": gUID, 1049 } 1050 1051 if err := a.client.NerdGraphQueryWithContext(ctx, getEntityQuery, vars, &resp); err != nil { 1052 return nil, err 1053 } 1054 1055 return &resp.Actor.Entity, nil 1056 } 1057 1058 const getEntityQuery = `query( 1059 $guid: EntityGuid!, 1060 ) { actor { entity( 1061 guid: $guid, 1062 ) { 1063 account { 1064 id 1065 name 1066 reportingEventTypes 1067 } 1068 accountId 1069 alertSeverity 1070 domain 1071 entityType 1072 goldenMetrics { 1073 context { 1074 account 1075 guid 1076 } 1077 metrics { 1078 name 1079 query 1080 title 1081 } 1082 } 1083 goldenTags { 1084 context { 1085 account 1086 guid 1087 } 1088 tags { 1089 key 1090 } 1091 } 1092 guid 1093 indexedAt 1094 name 1095 permalink 1096 recentAlertViolations { 1097 agentUrl 1098 alertSeverity 1099 closedAt 1100 label 1101 level 1102 openedAt 1103 violationId 1104 violationUrl 1105 } 1106 relatedEntities { 1107 nextCursor 1108 results { 1109 __typename 1110 createdAt 1111 type 1112 ... on EntityRelationshipDetectedEdge { 1113 __typename 1114 } 1115 ... on EntityRelationshipUserDefinedEdge { 1116 __typename 1117 } 1118 } 1119 } 1120 relationships { 1121 source { 1122 accountId 1123 entityType 1124 guid 1125 } 1126 target { 1127 accountId 1128 entityType 1129 guid 1130 } 1131 type 1132 } 1133 reporting 1134 serviceLevel { 1135 indicators { 1136 createdAt 1137 description 1138 entityGuid 1139 id 1140 name 1141 updatedAt 1142 } 1143 } 1144 tags { 1145 key 1146 values 1147 } 1148 tagsWithMetadata { 1149 key 1150 values { 1151 mutable 1152 value 1153 } 1154 } 1155 type 1156 ... on ApmApplicationEntity { 1157 __typename 1158 account { 1159 id 1160 name 1161 reportingEventTypes 1162 } 1163 apmBrowserSummary { 1164 ajaxRequestThroughput 1165 ajaxResponseTimeAverage 1166 jsErrorRate 1167 pageLoadThroughput 1168 pageLoadTimeAverage 1169 } 1170 apmSummary { 1171 apdexScore 1172 errorRate 1173 hostCount 1174 instanceCount 1175 nonWebResponseTimeAverage 1176 nonWebThroughput 1177 responseTimeAverage 1178 throughput 1179 webResponseTimeAverage 1180 webThroughput 1181 } 1182 applicationId 1183 deployments { 1184 changelog 1185 description 1186 permalink 1187 revision 1188 timestamp 1189 user 1190 } 1191 language 1192 metricNormalizationRules { 1193 action 1194 applicationGuid 1195 applicationName 1196 createdAt 1197 enabled 1198 id 1199 matchExpression 1200 notes 1201 replacement 1202 } 1203 recentAlertViolations { 1204 agentUrl 1205 alertSeverity 1206 closedAt 1207 label 1208 level 1209 openedAt 1210 violationId 1211 violationUrl 1212 } 1213 relatedEntities { 1214 nextCursor 1215 } 1216 relationships { 1217 type 1218 } 1219 runningAgentVersions { 1220 maxVersion 1221 minVersion 1222 } 1223 settings { 1224 apdexTarget 1225 serverSideConfig 1226 } 1227 tags { 1228 key 1229 values 1230 } 1231 tagsWithMetadata { 1232 key 1233 } 1234 } 1235 ... on ApmDatabaseInstanceEntity { 1236 __typename 1237 account { 1238 id 1239 name 1240 reportingEventTypes 1241 } 1242 host 1243 portOrPath 1244 recentAlertViolations { 1245 agentUrl 1246 alertSeverity 1247 closedAt 1248 label 1249 level 1250 openedAt 1251 violationId 1252 violationUrl 1253 } 1254 relatedEntities { 1255 nextCursor 1256 } 1257 relationships { 1258 type 1259 } 1260 tags { 1261 key 1262 values 1263 } 1264 tagsWithMetadata { 1265 key 1266 } 1267 vendor 1268 } 1269 ... on ApmExternalServiceEntity { 1270 __typename 1271 account { 1272 id 1273 name 1274 reportingEventTypes 1275 } 1276 externalSummary { 1277 responseTimeAverage 1278 throughput 1279 } 1280 host 1281 recentAlertViolations { 1282 agentUrl 1283 alertSeverity 1284 closedAt 1285 label 1286 level 1287 openedAt 1288 violationId 1289 violationUrl 1290 } 1291 relatedEntities { 1292 nextCursor 1293 } 1294 relationships { 1295 type 1296 } 1297 tags { 1298 key 1299 values 1300 } 1301 tagsWithMetadata { 1302 key 1303 } 1304 } 1305 ... on BrowserApplicationEntity { 1306 __typename 1307 account { 1308 id 1309 name 1310 reportingEventTypes 1311 } 1312 agentInstallType 1313 applicationId 1314 browserSummary { 1315 ajaxRequestThroughput 1316 ajaxResponseTimeAverage 1317 jsErrorRate 1318 pageLoadThroughput 1319 pageLoadTimeAverage 1320 pageLoadTimeMedian 1321 spaResponseTimeAverage 1322 spaResponseTimeMedian 1323 } 1324 metricNormalizationRules { 1325 action 1326 applicationGuid 1327 applicationName 1328 createdAt 1329 enabled 1330 id 1331 matchExpression 1332 notes 1333 replacement 1334 } 1335 recentAlertViolations { 1336 agentUrl 1337 alertSeverity 1338 closedAt 1339 label 1340 level 1341 openedAt 1342 violationId 1343 violationUrl 1344 } 1345 relatedEntities { 1346 nextCursor 1347 } 1348 relationships { 1349 type 1350 } 1351 runningAgentVersions { 1352 maxVersion 1353 minVersion 1354 } 1355 servingApmApplicationId 1356 settings { 1357 apdexTarget 1358 } 1359 tags { 1360 key 1361 values 1362 } 1363 tagsWithMetadata { 1364 key 1365 } 1366 } 1367 ... on DashboardEntity { 1368 __typename 1369 account { 1370 id 1371 name 1372 reportingEventTypes 1373 } 1374 createdAt 1375 dashboardParentGuid 1376 description 1377 owner { 1378 email 1379 userId 1380 } 1381 pages { 1382 createdAt 1383 description 1384 guid 1385 name 1386 updatedAt 1387 } 1388 permissions 1389 recentAlertViolations { 1390 agentUrl 1391 alertSeverity 1392 closedAt 1393 label 1394 level 1395 openedAt 1396 violationId 1397 violationUrl 1398 } 1399 relatedEntities { 1400 nextCursor 1401 } 1402 relationships { 1403 type 1404 } 1405 tags { 1406 key 1407 values 1408 } 1409 tagsWithMetadata { 1410 key 1411 } 1412 updatedAt 1413 } 1414 ... on ExternalEntity { 1415 __typename 1416 account { 1417 id 1418 name 1419 reportingEventTypes 1420 } 1421 recentAlertViolations { 1422 agentUrl 1423 alertSeverity 1424 closedAt 1425 label 1426 level 1427 openedAt 1428 violationId 1429 violationUrl 1430 } 1431 relatedEntities { 1432 nextCursor 1433 } 1434 relationships { 1435 type 1436 } 1437 tags { 1438 key 1439 values 1440 } 1441 tagsWithMetadata { 1442 key 1443 } 1444 } 1445 ... on GenericEntity { 1446 __typename 1447 account { 1448 id 1449 name 1450 reportingEventTypes 1451 } 1452 recentAlertViolations { 1453 agentUrl 1454 alertSeverity 1455 closedAt 1456 label 1457 level 1458 openedAt 1459 violationId 1460 violationUrl 1461 } 1462 relatedEntities { 1463 nextCursor 1464 } 1465 relationships { 1466 type 1467 } 1468 tags { 1469 key 1470 values 1471 } 1472 tagsWithMetadata { 1473 key 1474 } 1475 } 1476 ... on GenericInfrastructureEntity { 1477 __typename 1478 account { 1479 id 1480 name 1481 reportingEventTypes 1482 } 1483 integrationTypeCode 1484 recentAlertViolations { 1485 agentUrl 1486 alertSeverity 1487 closedAt 1488 label 1489 level 1490 openedAt 1491 violationId 1492 violationUrl 1493 } 1494 relatedEntities { 1495 nextCursor 1496 } 1497 relationships { 1498 type 1499 } 1500 tags { 1501 key 1502 values 1503 } 1504 tagsWithMetadata { 1505 key 1506 } 1507 } 1508 ... on InfrastructureAwsLambdaFunctionEntity { 1509 __typename 1510 account { 1511 id 1512 name 1513 reportingEventTypes 1514 } 1515 integrationTypeCode 1516 recentAlertViolations { 1517 agentUrl 1518 alertSeverity 1519 closedAt 1520 label 1521 level 1522 openedAt 1523 violationId 1524 violationUrl 1525 } 1526 relatedEntities { 1527 nextCursor 1528 } 1529 relationships { 1530 type 1531 } 1532 runtime 1533 tags { 1534 key 1535 values 1536 } 1537 tagsWithMetadata { 1538 key 1539 } 1540 } 1541 ... on InfrastructureHostEntity { 1542 __typename 1543 account { 1544 id 1545 name 1546 reportingEventTypes 1547 } 1548 hostSummary { 1549 cpuUtilizationPercent 1550 diskUsedPercent 1551 memoryUsedPercent 1552 networkReceiveRate 1553 networkTransmitRate 1554 servicesCount 1555 } 1556 recentAlertViolations { 1557 agentUrl 1558 alertSeverity 1559 closedAt 1560 label 1561 level 1562 openedAt 1563 violationId 1564 violationUrl 1565 } 1566 relatedEntities { 1567 nextCursor 1568 } 1569 relationships { 1570 type 1571 } 1572 tags { 1573 key 1574 values 1575 } 1576 tagsWithMetadata { 1577 key 1578 } 1579 } 1580 ... on MobileApplicationEntity { 1581 __typename 1582 account { 1583 id 1584 name 1585 reportingEventTypes 1586 } 1587 applicationId 1588 metricNormalizationRules { 1589 action 1590 applicationGuid 1591 applicationName 1592 createdAt 1593 enabled 1594 id 1595 matchExpression 1596 notes 1597 replacement 1598 } 1599 mobileSummary { 1600 appLaunchCount 1601 crashCount 1602 crashRate 1603 httpErrorRate 1604 httpRequestCount 1605 httpRequestRate 1606 httpResponseTimeAverage 1607 mobileSessionCount 1608 networkFailureRate 1609 usersAffectedCount 1610 } 1611 recentAlertViolations { 1612 agentUrl 1613 alertSeverity 1614 closedAt 1615 label 1616 level 1617 openedAt 1618 violationId 1619 violationUrl 1620 } 1621 relatedEntities { 1622 nextCursor 1623 } 1624 relationships { 1625 type 1626 } 1627 tags { 1628 key 1629 values 1630 } 1631 tagsWithMetadata { 1632 key 1633 } 1634 } 1635 ... on SecureCredentialEntity { 1636 __typename 1637 account { 1638 id 1639 name 1640 reportingEventTypes 1641 } 1642 description 1643 recentAlertViolations { 1644 agentUrl 1645 alertSeverity 1646 closedAt 1647 label 1648 level 1649 openedAt 1650 violationId 1651 violationUrl 1652 } 1653 relatedEntities { 1654 nextCursor 1655 } 1656 relationships { 1657 type 1658 } 1659 secureCredentialId 1660 secureCredentialSummary { 1661 failingMonitorCount 1662 monitorCount 1663 } 1664 tags { 1665 key 1666 values 1667 } 1668 tagsWithMetadata { 1669 key 1670 } 1671 updatedAt 1672 } 1673 ... on SyntheticMonitorEntity { 1674 __typename 1675 account { 1676 id 1677 name 1678 reportingEventTypes 1679 } 1680 monitorId 1681 monitorSummary { 1682 locationsFailing 1683 locationsRunning 1684 status 1685 successRate 1686 } 1687 monitorType 1688 monitoredUrl 1689 period 1690 recentAlertViolations { 1691 agentUrl 1692 alertSeverity 1693 closedAt 1694 label 1695 level 1696 openedAt 1697 violationId 1698 violationUrl 1699 } 1700 relatedEntities { 1701 nextCursor 1702 } 1703 relationships { 1704 type 1705 } 1706 tags { 1707 key 1708 values 1709 } 1710 tagsWithMetadata { 1711 key 1712 } 1713 } 1714 ... on ThirdPartyServiceEntity { 1715 __typename 1716 account { 1717 id 1718 name 1719 reportingEventTypes 1720 } 1721 recentAlertViolations { 1722 agentUrl 1723 alertSeverity 1724 closedAt 1725 label 1726 level 1727 openedAt 1728 violationId 1729 violationUrl 1730 } 1731 relatedEntities { 1732 nextCursor 1733 } 1734 relationships { 1735 type 1736 } 1737 tags { 1738 key 1739 values 1740 } 1741 tagsWithMetadata { 1742 key 1743 } 1744 } 1745 ... on UnavailableEntity { 1746 __typename 1747 account { 1748 id 1749 name 1750 reportingEventTypes 1751 } 1752 recentAlertViolations { 1753 agentUrl 1754 alertSeverity 1755 closedAt 1756 label 1757 level 1758 openedAt 1759 violationId 1760 violationUrl 1761 } 1762 relatedEntities { 1763 nextCursor 1764 } 1765 relationships { 1766 type 1767 } 1768 tags { 1769 key 1770 values 1771 } 1772 tagsWithMetadata { 1773 key 1774 } 1775 } 1776 ... on WorkloadEntity { 1777 __typename 1778 account { 1779 id 1780 name 1781 reportingEventTypes 1782 } 1783 createdAt 1784 createdByUser { 1785 email 1786 gravatar 1787 id 1788 name 1789 } 1790 recentAlertViolations { 1791 agentUrl 1792 alertSeverity 1793 closedAt 1794 label 1795 level 1796 openedAt 1797 violationId 1798 violationUrl 1799 } 1800 relatedEntities { 1801 nextCursor 1802 } 1803 relationships { 1804 type 1805 } 1806 tags { 1807 key 1808 values 1809 } 1810 tagsWithMetadata { 1811 key 1812 } 1813 updatedAt 1814 workloadStatus { 1815 description 1816 statusSource 1817 statusValue 1818 summary 1819 } 1820 } 1821 } } }` 1822 1823 // Search for entities using a custom query. 1824 // 1825 // For more details on how to create a custom query 1826 // and what entity data you can request, visit our 1827 // [entity docs](https://docs.newrelic.com/docs/apis/graphql-api/tutorials/use-new-relic-graphql-api-query-entities). 1828 // 1829 // Note: you must supply either a `query` OR a `queryBuilder` argument, not both. 1830 func (a *Entities) GetEntitySearch( 1831 options EntitySearchOptions, 1832 query string, 1833 queryBuilder EntitySearchQueryBuilder, 1834 sortBy []EntitySearchSortCriteria, 1835 ) (*EntitySearch, error) { 1836 return a.GetEntitySearchWithContext(context.Background(), 1837 options, 1838 query, 1839 queryBuilder, 1840 sortBy, 1841 ) 1842 } 1843 1844 // Search for entities using a custom query. 1845 // 1846 // For more details on how to create a custom query 1847 // and what entity data you can request, visit our 1848 // [entity docs](https://docs.newrelic.com/docs/apis/graphql-api/tutorials/use-new-relic-graphql-api-query-entities). 1849 // 1850 // Note: you must supply either a `query` OR a `queryBuilder` argument, not both. 1851 func (a *Entities) GetEntitySearchWithContext( 1852 ctx context.Context, 1853 options EntitySearchOptions, 1854 query string, 1855 queryBuilder EntitySearchQueryBuilder, 1856 sortBy []EntitySearchSortCriteria, 1857 ) (*EntitySearch, error) { 1858 1859 resp := entitySearchResponse{} 1860 vars := map[string]interface{}{ 1861 "options": options, 1862 "query": query, 1863 "queryBuilder": queryBuilder, 1864 "sortBy": sortBy, 1865 } 1866 1867 if err := a.client.NerdGraphQueryWithContext(ctx, getEntitySearchQuery, vars, &resp); err != nil { 1868 return nil, err 1869 } 1870 1871 return &resp.Actor.EntitySearch, nil 1872 } 1873 1874 const getEntitySearchQuery = `query( 1875 $queryBuilder: EntitySearchQueryBuilder, 1876 ) { actor { entitySearch( 1877 queryBuilder: $queryBuilder, 1878 ) { 1879 count 1880 query 1881 results { 1882 entities { 1883 __typename 1884 accountId 1885 alertSeverity 1886 domain 1887 entityType 1888 guid 1889 indexedAt 1890 name 1891 permalink 1892 reporting 1893 type 1894 ... on ApmApplicationEntityOutline { 1895 __typename 1896 applicationId 1897 language 1898 } 1899 ... on ApmDatabaseInstanceEntityOutline { 1900 __typename 1901 host 1902 portOrPath 1903 vendor 1904 } 1905 ... on ApmExternalServiceEntityOutline { 1906 __typename 1907 host 1908 } 1909 ... on BrowserApplicationEntityOutline { 1910 __typename 1911 agentInstallType 1912 applicationId 1913 servingApmApplicationId 1914 } 1915 ... on DashboardEntityOutline { 1916 __typename 1917 createdAt 1918 dashboardParentGuid 1919 permissions 1920 updatedAt 1921 } 1922 ... on ExternalEntityOutline { 1923 __typename 1924 } 1925 ... on GenericEntityOutline { 1926 __typename 1927 } 1928 ... on GenericInfrastructureEntityOutline { 1929 __typename 1930 integrationTypeCode 1931 } 1932 ... on InfrastructureAwsLambdaFunctionEntityOutline { 1933 __typename 1934 integrationTypeCode 1935 runtime 1936 } 1937 ... on InfrastructureHostEntityOutline { 1938 __typename 1939 } 1940 ... on MobileApplicationEntityOutline { 1941 __typename 1942 applicationId 1943 } 1944 ... on SecureCredentialEntityOutline { 1945 __typename 1946 description 1947 secureCredentialId 1948 updatedAt 1949 } 1950 ... on SyntheticMonitorEntityOutline { 1951 __typename 1952 monitorId 1953 monitorType 1954 monitoredUrl 1955 period 1956 } 1957 ... on ThirdPartyServiceEntityOutline { 1958 __typename 1959 } 1960 ... on UnavailableEntityOutline { 1961 __typename 1962 } 1963 ... on WorkloadEntityOutline { 1964 __typename 1965 createdAt 1966 updatedAt 1967 } 1968 } 1969 nextCursor 1970 } 1971 types { 1972 count 1973 domain 1974 entityType 1975 type 1976 } 1977 } } }` 1978 1979 // Search for entities using a custom query. 1980 // 1981 // For more details on how to create a custom query 1982 // and what entity data you can request, visit our 1983 // [entity docs](https://docs.newrelic.com/docs/apis/graphql-api/tutorials/use-new-relic-graphql-api-query-entities). 1984 // 1985 // Note: you must supply either a `query` OR a `queryBuilder` argument, not both. 1986 func (a *Entities) GetEntitySearchByQuery( 1987 options EntitySearchOptions, 1988 query string, 1989 sortBy []EntitySearchSortCriteria, 1990 ) (*EntitySearch, error) { 1991 return a.GetEntitySearchByQueryWithContext(context.Background(), 1992 options, 1993 query, 1994 sortBy, 1995 ) 1996 } 1997 1998 // Search for entities using a custom query. 1999 // 2000 // For more details on how to create a custom query 2001 // and what entity data you can request, visit our 2002 // [entity docs](https://docs.newrelic.com/docs/apis/graphql-api/tutorials/use-new-relic-graphql-api-query-entities). 2003 // 2004 // Note: you must supply either a `query` OR a `queryBuilder` argument, not both. 2005 func (a *Entities) GetEntitySearchByQueryWithContext( 2006 ctx context.Context, 2007 options EntitySearchOptions, 2008 query string, 2009 sortBy []EntitySearchSortCriteria, 2010 ) (*EntitySearch, error) { 2011 2012 resp := entitySearchResponse{} 2013 vars := map[string]interface{}{ 2014 "options": options, 2015 "query": query, 2016 "sortBy": sortBy, 2017 } 2018 2019 if err := a.client.NerdGraphQueryWithContext(ctx, getEntitySearchByQuery, vars, &resp); err != nil { 2020 return nil, err 2021 } 2022 2023 return &resp.Actor.EntitySearch, nil 2024 } 2025 2026 const getEntitySearchByQuery = `query( 2027 $query: String, 2028 ) { actor { entitySearch( 2029 query: $query, 2030 ) { 2031 count 2032 query 2033 results { 2034 entities { 2035 __typename 2036 accountId 2037 alertSeverity 2038 domain 2039 entityType 2040 guid 2041 indexedAt 2042 name 2043 permalink 2044 reporting 2045 type 2046 ... on ApmApplicationEntityOutline { 2047 __typename 2048 applicationId 2049 language 2050 } 2051 ... on ApmDatabaseInstanceEntityOutline { 2052 __typename 2053 host 2054 portOrPath 2055 vendor 2056 } 2057 ... on ApmExternalServiceEntityOutline { 2058 __typename 2059 host 2060 } 2061 ... on BrowserApplicationEntityOutline { 2062 __typename 2063 agentInstallType 2064 applicationId 2065 servingApmApplicationId 2066 } 2067 ... on DashboardEntityOutline { 2068 __typename 2069 createdAt 2070 dashboardParentGuid 2071 permissions 2072 updatedAt 2073 } 2074 ... on ExternalEntityOutline { 2075 __typename 2076 } 2077 ... on GenericEntityOutline { 2078 __typename 2079 } 2080 ... on GenericInfrastructureEntityOutline { 2081 __typename 2082 integrationTypeCode 2083 } 2084 ... on InfrastructureAwsLambdaFunctionEntityOutline { 2085 __typename 2086 integrationTypeCode 2087 runtime 2088 } 2089 ... on InfrastructureHostEntityOutline { 2090 __typename 2091 } 2092 ... on MobileApplicationEntityOutline { 2093 __typename 2094 applicationId 2095 } 2096 ... on SecureCredentialEntityOutline { 2097 __typename 2098 description 2099 secureCredentialId 2100 updatedAt 2101 } 2102 ... on SyntheticMonitorEntityOutline { 2103 __typename 2104 monitorId 2105 monitorType 2106 monitoredUrl 2107 period 2108 } 2109 ... on ThirdPartyServiceEntityOutline { 2110 __typename 2111 } 2112 ... on UnavailableEntityOutline { 2113 __typename 2114 } 2115 ... on WorkloadEntityOutline { 2116 __typename 2117 createdAt 2118 updatedAt 2119 } 2120 } 2121 nextCursor 2122 } 2123 types { 2124 count 2125 domain 2126 entityType 2127 type 2128 } 2129 } } }`