Skip to content

Commit d28463f

Browse files
javrudskyHarness
authored andcommitted
feat: [fme-7133]: Added several CCM tools (#40)
* [fme-7133] - Removing 'gateway' from GraphQL path * [fme-7133] - Using MM/DD/YYYY format in LastPeriodCostCcmPerspective tool. Removing unused imports * [fme-7133] - Merge with master * [fme-7133] Added Get Perspective Grid with budget graphql query * [fme-5745] - Added perspective time series graphql API * [fme-4352] - Fixing group by AWS fields constants * [fme-4352] Fix for key values filter parameter config * [fme-4352] Improving description for MCP tool for ccm_perspective_grid * [fme-4352] Fixing filter field description * [fme-4352] - Adding filtering and grouping by key/value fields (Label, LabelV2 and Cost Categories) * [FME-4352] - Added Field ID filters * [fme-4352] - Using default Account ID in perspectives * [fme-4352] Added initial setup integration for FetchperspectiveGrid GraphQL query * Adding rules when creating perspective * Added View preferences to create a perspective * Integration to create a basic perspective * Added integration for service Get
1 parent 70c6966 commit d28463f

16 files changed

+2431
-14
lines changed

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,18 @@ Toolset Name: `dashboards`
8585

8686
Toolset Name: `cloudcostmanagement`
8787

88-
- `get_ccm_overview`: Retrieve the cost overview for a specific account.
89-
- `list_ccm_cost_categories`: List all cost categories names for a specified account.
90-
- `list_ccm_cost_categories_detail`: List all cost categories details for a specified account.
91-
- `get_ccm_cost_category`: Retrieve a cost category detail by Id for a specified account.
88+
- `get_ccm_overview`: Retrieves the cost overview for a specific account.
89+
- `list_ccm_cost_categories`: List all cost categories names for a specified account.
90+
- `list_ccm_cost_categories_detail`: List all cost categories details for a specified account.
91+
- `get_ccm_cost_category`: Retrieve a cost category detail by Id for a specified account.
92+
- `list_ccm_perspectives_detail`: List all perspectives for a specified account.
93+
- `get_ccm_perspective`: Retrieves a perspective by Id for a specified account.
94+
- `get_last_period_cost_ccm_perspective`: Retrieves the cost for a specified period and perspective within a given account.
95+
- `get_last_twelve_months_cost_ccm_perspective`: Retrieves a monthly cost breakdown for the past 12 months for a perspective within a specified account.
96+
- `create_ccm_perspective`: Creates a perspective for a specified account.
97+
- `ccm_perspective_grid`: Query detailed cost perspective data in Harness Cloud Cost Management.
98+
- `ccm_perspective_time_series`: Query detailed cost perspective data, grouped by time in Harness Cloud Cost Management.
99+
- `ccm_perspective_summary_with_budget`: Query a summary of cost perspectives with budget information in Harness Cloud Cost Management, including detailed cost and budget data grouped by time.
92100
- `get_ccm_commitment_coverage`: Get commitment coverage information for an account in Harness Cloud Cost Management
93101

94102
#### Chaos Engineering Toolset
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
package ccmcommons
2+
3+
const CCMPerspectiveGridQuery = `
4+
query FetchperspectiveGrid(
5+
$filters: [QLCEViewFilterWrapperInput],
6+
$groupBy: [QLCEViewGroupByInput],
7+
$limit: Int,
8+
$offset: Int,
9+
$aggregateFunction: [QLCEViewAggregationInput],
10+
$isClusterOnly: Boolean!,
11+
$isClusterHourlyData: Boolean = null,
12+
$preferences: ViewPreferencesInput
13+
) {
14+
perspectiveGrid(
15+
aggregateFunction: $aggregateFunction
16+
filters: $filters
17+
groupBy: $groupBy
18+
limit: $limit
19+
offset: $offset
20+
preferences: $preferences
21+
isClusterHourlyData: $isClusterHourlyData
22+
sortCriteria: [{sortType: COST, sortOrder: DESCENDING}]
23+
) {
24+
data {
25+
name
26+
id
27+
cost
28+
costTrend
29+
__typename
30+
}
31+
__typename
32+
}
33+
perspectiveTotalCount(
34+
filters: $filters
35+
groupBy: $groupBy
36+
isClusterQuery: $isClusterOnly
37+
isClusterHourlyData: $isClusterHourlyData
38+
)
39+
}`
40+
41+
const CCMPerspectiveTimeSeriesQuery = `
42+
query FetchPerspectiveTimeSeries(
43+
$filters: [QLCEViewFilterWrapperInput],
44+
$groupBy: [QLCEViewGroupByInput],
45+
$limit: Int,
46+
$preferences: ViewPreferencesInput,
47+
$isClusterHourlyData: Boolean = null
48+
) {
49+
perspectiveTimeSeriesStats(
50+
filters: $filters
51+
groupBy: $groupBy
52+
limit: $limit
53+
preferences: $preferences
54+
isClusterHourlyData: $isClusterHourlyData
55+
aggregateFunction: [{operationType: SUM, columnName: "cost"}]
56+
sortCriteria: [{sortType: COST, sortOrder: DESCENDING}]
57+
) {
58+
stats {
59+
values {
60+
key {
61+
id
62+
name
63+
type
64+
__typename
65+
}
66+
value
67+
__typename
68+
}
69+
time
70+
__typename
71+
}
72+
__typename
73+
}
74+
}
75+
`
76+
77+
const CCMPerspectiveSummaryWithBudgetQuery = `
78+
query FetchPerspectiveDetailsSummaryWithBudget(
79+
$filters: [QLCEViewFilterWrapperInput],
80+
$aggregateFunction: [QLCEViewAggregationInput],
81+
$isClusterQuery: Boolean,
82+
$isClusterHourlyData: Boolean = null,
83+
$groupBy: [QLCEViewGroupByInput],
84+
$preferences: ViewPreferencesInput
85+
) {
86+
perspectiveTrendStats(
87+
filters: $filters
88+
aggregateFunction: $aggregateFunction
89+
isClusterQuery: $isClusterQuery
90+
isClusterHourlyData: $isClusterHourlyData
91+
groupBy: $groupBy
92+
preferences: $preferences
93+
) {
94+
cost {
95+
statsDescription
96+
statsLabel
97+
statsTrend
98+
statsValue
99+
value
100+
__typename
101+
}
102+
idleCost {
103+
statsLabel
104+
statsValue
105+
value
106+
__typename
107+
}
108+
unallocatedCost {
109+
statsLabel
110+
statsValue
111+
value
112+
__typename
113+
}
114+
utilizedCost {
115+
statsLabel
116+
statsValue
117+
value
118+
__typename
119+
}
120+
efficiencyScoreStats {
121+
statsLabel
122+
statsTrend
123+
statsValue
124+
__typename
125+
}
126+
__typename
127+
}
128+
perspectiveForecastCost(
129+
filters: $filters
130+
aggregateFunction: $aggregateFunction
131+
isClusterQuery: $isClusterQuery
132+
isClusterHourlyData: $isClusterHourlyData
133+
groupBy: $groupBy
134+
preferences: $preferences
135+
) {
136+
cost {
137+
statsLabel
138+
statsTrend
139+
statsValue
140+
statsDescription
141+
value
142+
__typename
143+
}
144+
__typename
145+
}
146+
}
147+
`

client/cloudcostmanagement.go renamed to client/ccmcosts.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,11 @@ func setCCMPaginationDefault(opts *dto.CCMPaginationOptions) {
126126
if opts == nil {
127127
return
128128
}
129-
if opts.Offset <= 0 {
130-
opts.Offset = 1
131-
}
129+
// The code below is commented out because when filtering is applied and Offset (or Page) == 1
130+
// Seach does not retrieves results, only total count (In get perspective details endpoint)
131+
// if opts.Offset <= 0 {
132+
// opts.Offset = 1
133+
// }
132134
safeMaxPageSize := utils.SafeIntToInt32(maxPageSize, 20)
133135
if opts.Limit <= 0 {
134136
opts.Limit = utils.SafeIntToInt32(defaultPageSize, 5)

0 commit comments

Comments
 (0)