Skip to content

Commit dc59b30

Browse files
javrudskyHarness
authored andcommitted
feat: [fme-7210]: Filter Values GraphQL Tool and rules for perspective (#76)
* [fme-7210] Fixing several minor issues suggested by AI * [fme-7210] Using standard view rules format * [fme-7210] Removed commented code * [fme-7210] Fixing filter constant * [fme-7210] Removed default values used for testing * fme-7210] Merge with master * [fme-7210] - Merge with master * [fme-7210] - Removing debug logs * [fme-7210] - Fixing issues in Perspective Rules adapter * [fme-7210] Fixing issue in CCM Graphql Filter values filter * [fme-7210] Adding filter by values graphql functions and functions to improve create perspective flow * [fme-7210] Added graphql filter values queries to get values needed to create a perspective * [fme-7210] initial prompt * [fme-7194] - Return NewToolResultError instead of generic error * [fme-7194] - Merge with master * [fme-7194] - Fixing view id issue * [fme-7168] - Fixing tool name. fetch_ccm_metadata to get_ccm_metadata * [fme-7168] - Adding Perspective Recommendations operation * [fme-7168] - Added Fetch CCM Metadata Too
1 parent 5f6d01c commit dc59b30

15 files changed

+1374
-509
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ Toolset Name: `cloudcostmanagement`
116116
- `ccm_perspective_budget`: Query the budget information for a perspective in Harness Cloud Cost Management.
117117
- `get_ccm_metadata`: Retrieves metadata about available cloud connectors, cost data sources, default perspectives, and currency preferences in Harness Cloud Cost Management.
118118
- `ccm_perspective_recommendations`: PerspectiveRecommendations: Returns monthly cost, savings, and a list of open recommendations for a perspective in Harness Cloud Cost Management.
119+
- `ccm_perspective_filter_values`: Returns available filter values for a cost perspective, enabling dynamic discovery of valid options for advanced queries in Harness Cloud Cost Management.
119120
- `get_ccm_commitment_coverage`: Get commitment coverage information for an account in Harness Cloud Cost Management
120121
- `get_ccm_commitment_savings`: Get commitment savings information for an account in Harness Cloud Cost Management
121122

client/ccmcommons/ccmconstants.go

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
package ccmcommons
2+
3+
var OutputFields = []map[string]string{
4+
{
5+
"fieldId": "region",
6+
"fieldName": "Region",
7+
"identifier": "COMMON",
8+
"identifierName": "Common",
9+
},
10+
{
11+
"fieldId": "awsUsageaccountid",
12+
"fieldName": "Account",
13+
"identifier": "AWS",
14+
"identifierName": "AWS",
15+
},
16+
{
17+
"fieldId": "awsServicecode",
18+
"fieldName": "Service",
19+
"identifier": "AWS",
20+
"identifierName": "AWS",
21+
},
22+
{
23+
"fieldId": "awsBillingEntity",
24+
"fieldName": "Billing Entity",
25+
"identifier": "AWS",
26+
"identifierName": "AWS",
27+
},
28+
{
29+
"fieldId": "awsInstancetype",
30+
"fieldName": "Instance Type",
31+
"identifier": "AWS",
32+
"identifierName": "AWS",
33+
},
34+
{
35+
"fieldId": "awsLineItemType",
36+
"fieldName": "Line Item Type",
37+
"identifier": "AWS",
38+
"identifierName": "AWS",
39+
},
40+
{
41+
"fieldId": "awspayeraccountid",
42+
"fieldName": "Payer Account",
43+
"identifier": "AWS",
44+
"identifierName": "AWS",
45+
},
46+
{
47+
"fieldId": "awsUsageType",
48+
"fieldName": "Usage Type",
49+
"identifier": "AWS",
50+
"identifierName": "AWS",
51+
},
52+
{
53+
"fieldId": "cloudProvider",
54+
"fieldName": "Cloud Provider",
55+
"identifier": "COMMON",
56+
"identifierName": "Common",
57+
},
58+
{
59+
"fieldId": "none",
60+
"fieldName": "None",
61+
"identifier": "COMMON",
62+
"identifierName": "Common",
63+
},
64+
{
65+
"fieldId": "product",
66+
"fieldName": "Product",
67+
"identifier": "COMMON",
68+
"identifierName": "Common",
69+
},
70+
}
71+
72+
var OutputKeyValueFields = []map[string]string{
73+
{
74+
"fieldId": "labels.value",
75+
"fieldName": "", // Label name
76+
"identifier": "LABEL",
77+
"identifierName": "Label",
78+
},
79+
{
80+
"fieldId": "labels.value",
81+
"fieldName": "", // Label name
82+
"identifier": "LABEL_V2",
83+
"identifierName": "Label V2",
84+
},
85+
{
86+
"fieldId": "", // Cost Category Id
87+
"fieldName": "", // Cost Category Name
88+
"identifier": "BUSINESS_MAPPING",
89+
"identifierName": "Cost Categories",
90+
},
91+
}
92+
93+
var OutputKeyFields = []map[string]string{
94+
{
95+
"fieldId": "labels.key",
96+
"fieldName": "",
97+
"identifier": "LABEL",
98+
},
99+
{
100+
"fieldId": "labels.key2",
101+
"fieldName": "",
102+
"identifier": "LABEL_V2",
103+
},
104+
}
105+
106+
var DefaultGroupBy = []map[string]any{
107+
{
108+
"entityGroupBy": map[string]any{
109+
"fieldId": "product",
110+
"fieldName": "Product",
111+
"identifier": "COMMON",
112+
"identifierName": "Common",
113+
},
114+
},
115+
}
116+
117+
var ConditionFieldDescriptions = []map[string]string{
118+
{
119+
"fieldId": "region",
120+
"description": "Use this field to create a view filter rule to filter by cloud region.",
121+
},
122+
{
123+
"fieldId": "awsUsageaccountid",
124+
"description": "Use this field to create a view filter rule to filter by AWS usage account ID.",
125+
},
126+
{
127+
"fieldId": "awsServicecode",
128+
"description": "Use this field to create a view filter rule to filter by AWS service code.",
129+
},
130+
{
131+
"fieldId": "awsBillingEntity",
132+
"description": "Use this field to create a view filter rule to filter by AWS billing entity.",
133+
},
134+
{
135+
"fieldId": "awsInstancetype",
136+
"description": "Use this field to create a view filter rule to filter by AWS instance type.",
137+
},
138+
{
139+
"fieldId": "awsLineItemType",
140+
"description": "Use this field to create a view filter rule to filter by AWS line item type.",
141+
},
142+
{
143+
"fieldId": "awspayeraccountid",
144+
"description": "Use this field to create a view filter rule to filter by AWS payer account ID.",
145+
},
146+
{
147+
"fieldId": "awsUsageType",
148+
"description": "Use this field to create a view filter rule to filter by AWS usage type.",
149+
},
150+
{
151+
"fieldId": "cloudprovider",
152+
"description": "use this field to create a view filter rule to filter by cloud provider.",
153+
},
154+
{
155+
"fieldId": "none",
156+
"description": "use this field to create a view filter rule with no filter or grouping applied.",
157+
},
158+
{
159+
"fieldId": "product",
160+
"description": "use this field to create a view filter rule to filter by product.",
161+
},
162+
}
163+
164+
var labelDescription = `
165+
Use this field to create a view filter rule to filter by Label.
166+
Use the following Map format:
167+
{
168+
"field1_id": "label",
169+
"field2_id": Select a value from the list returned by the 'ccm_filter_values' tool with field_type set to 'label'
170+
}
171+
`
172+
173+
var labelV2Description = `
174+
Use this field to create a view filter rule to filter by Label V2.
175+
Use the following Map format:
176+
{
177+
"field1_id": "label_v2",
178+
"field2_id": Select a value from the list returned by the 'ccm_filter_values' tool with field_type set to 'label_v2'
179+
}
180+
`
181+
var costCategoryDescription = `
182+
Use this field to create a view filter rule to filter by Cost Category.
183+
Use the following Map format:
184+
{
185+
"field1_id": "business_mapping",
186+
"field2_id": "Select a value from the 'uuid' field returned by the tool list_ccm_cost_categories_detail.",
187+
"field3_id": Select the value from 'name' field corresonding to the 'uuid' field returned by the list_ccm_cost_categories_detail used in 'field_id'
188+
}
189+
`
190+
191+
var ConditionKeyValueFieldDescriptions = []map[string]string{
192+
{
193+
"fieldId": "label",
194+
"description": labelDescription,
195+
},
196+
{
197+
"fieldId": "label_v2",
198+
"description": labelV2Description,
199+
},
200+
{
201+
"fieldId": "business_mapping",
202+
"description": costCategoryDescription,
203+
},
204+
}

0 commit comments

Comments
 (0)