Skip to content

Commit

Permalink
added app and hr api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
chrlic committed Sep 4, 2024
1 parent 5677c7f commit f678bf8
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 0 deletions.
77 changes: 77 additions & 0 deletions application.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
MIT License
Copyright (c) 2023 David Lopes
Copyright (c) 2024 Cisco Systems, Inc. and its affiliates
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -69,6 +70,65 @@ type Application struct {
} `json:"applicationTypeInfo"`
}

// DANGER ZONE
// following types are used for UNPUBLISHED api call and it may change in the future
type AllInternalApplications struct {
ApmApplications []GenericApplication `json:"apmApplications"`
EumWebApplications []GenericApplication `json:"eumWebApplications"`
DbMonApplication GenericApplication `json:"dbMonApplication"`
OverageMonitoringApplication GenericApplication `json:"overageMonitoringApplication"`
SimApplication GenericApplication `json:"simApplication"`
AnalyticsApplication GenericApplication `json:"analyticsApplication"`
MobileAppContainers []GenericApplication `json:"mobileAppContainers"`
IotApplications []GenericApplication `json:"iotApplications"`
CloudMonitoringApplication GenericApplication `json:"cloudMonitoringApplication"`
APIMonitoringApplications []GenericApplication `json:"apiMonitoringApplications"`
CoreWebVitalsApplication GenericApplication `json:"coreWebVitalsApplication"`
}
type GenericApplication struct {
ID int `json:"id"`
Version int `json:"version"`
Name string `json:"name"`
NameUnique bool `json:"nameUnique"`
BuiltIn bool `json:"builtIn"`
CreatedBy string `json:"createdBy"`
CreatedOn int64 `json:"createdOn"`
ModifiedBy string `json:"modifiedBy"`
ModifiedOn int64 `json:"modifiedOn"`
Description string `json:"description"`
Template bool `json:"template"`
Active bool `json:"active"`
Running bool `json:"running"`
RunningSince any `json:"runningSince"`
DeployWorkflowID int `json:"deployWorkflowId"`
UndeployWorkflowID int `json:"undeployWorkflowId"`
Visualization any `json:"visualization"`
EnvironmentProperties []EnvironmentProperties `json:"environmentProperties"`
EumAppName string `json:"eumAppName"`
AccountGUID string `json:"accountGuid"`
ApplicationTypeInfo ApplicationTypeInfo `json:"applicationTypeInfo"`
}
type ApplicationTypeInfo struct {
ApplicationTypes []string `json:"applicationTypes"`
EumEnabled bool `json:"eumEnabled"`
EumWebEnabled bool `json:"eumWebEnabled"`
EumMobileEnabled bool `json:"eumMobileEnabled"`
EumIotEnabled bool `json:"eumIotEnabled"`
EumAPIMonitoringEnabled bool `json:"eumApiMonitoringEnabled"`
HasEumWebEntities bool `json:"hasEumWebEntities"`
HasMobileApps bool `json:"hasMobileApps"`
HasTiers bool `json:"hasTiers"`
NumberOfMobileApps int `json:"numberOfMobileApps"`
}
type EnvironmentProperties struct {
ID int `json:"id"`
Version int `json:"version"`
Name string `json:"name"`
Value string `json:"value"`
}

// DANGER ZONE END

// ApplicationService intermediates Application requests
type ApplicationService service

Expand Down Expand Up @@ -126,3 +186,20 @@ func (s *ApplicationService) ExportApplicationConfig(appID int) ([]byte, error)
}
return body, nil
}

// DANGER ZONE
// this is an UNPUBLISHED API call - it may change in the future
func (s *ApplicationService) GetAllInternalApplications() (*AllInternalApplications, error) {

url := "/controller/restui/applicationManagerUiBean/getApplicationsAllTypes"

apps := AllInternalApplications{}
err := s.client.Rest("GET", url, &apps, nil)
if err != nil {
return nil, err
}

return &apps, nil
}

// DANGER ZONE END
55 changes: 55 additions & 0 deletions healthRule.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,43 @@ type HealthRuleDetail struct {
EvalCriterias *EvalCriteriasSet `json:"evalCriterias"`
}

// DANGER ZONE
// this is an UNPUBLISHED API call - it may change in the future
type HealthRuleEvaluationResponse []struct {
AffectedEntity HealthRuleAffectedEntity `json:"affectedEntity"`
Health string `json:"health"`
EvaluationStatus string `json:"evaluationStatus"`
AggregationScopesStates []HealthRuleAggregationScopesStates `json:"aggregationScopesStates"`
Name string `json:"name"`
TierName any `json:"tierName"`
}
type HealthRuleAffectedEntity struct {
ID int `json:"id"`
Version int `json:"version"`
EntityType string `json:"entityType"`
EntityID int `json:"entityId"`
PrettyToString any `json:"prettyToString"`
}
type HealthRuleAggregationScope struct {
ID int `json:"id"`
Version int `json:"version"`
EntityType string `json:"entityType"`
EntityID int `json:"entityId"`
PrettyToString any `json:"prettyToString"`
}
type HealthRuleState struct {
Result string `json:"result"`
Severity string `json:"severity"`
TriggeredConditions []any `json:"triggeredConditions"`
}
type HealthRuleAggregationScopesStates struct {
AggregationScope HealthRuleAggregationScope `json:"aggregationScope"`
JmxAggregationScope any `json:"jmxAggregationScope"`
State HealthRuleState `json:"state"`
}

// DANGER ZONE END

// HealthRuleService intermediates Health Rules requests
type HealthRuleService service

Expand Down Expand Up @@ -201,3 +238,21 @@ func (s *HealthRuleService) DeleteHealthRule(appID int, ruleID int) error {

return nil
}

// DANGER ZONE
// this is an UNPUBLISHED API call - it may change in the future
// GET /controller/restui/healthRules/getHealthRuleCurrentEvaluationStatus/app/3503/healthRuleID/22196
func (s *HealthRuleService) GetHealthRuleEvaluationState(appID int, ruleID int) (*HealthRuleEvaluationResponse, error) {

url := "controller/restui/healthRules/getHealthRuleCurrentEvaluationStatus/app/" + strconv.Itoa(appID) + "/healthRuleID/" + strconv.Itoa(ruleID)

hr := HealthRuleEvaluationResponse{}
err := s.client.Rest("GET", url, &hr, nil)
if err != nil {
return nil, err
}

return &hr, nil
}

// DANGER ZONE END

0 comments on commit f678bf8

Please sign in to comment.