· 2 years ago · Jan 23, 2023, 07:30 PM
1 linkedAccount := "354839622786"
2
3 var d2 types.Dimension
4 d2 = "LINKED_ACCOUNT"
5
6 // Specify the time period for the utilization data
7 start1 := time.Now().AddDate(0, 0, -30)
8 end2 := time.Now()
9
10 // Create the input parameters for the API call
11 input := &costexplorer.GetSavingsPlansUtilizationInput{
12 TimePeriod: &types.DateInterval{
13 Start: aws.String(start1.Format("2006-01-02")),
14 End: aws.String(end2.Format("2006-01-02")),
15 },
16 Filter: &types.Expression{
17 Dimensions: &types.DimensionValues{
18 Key: d2,
19 Values: []string{linkedAccount},
20 },
21 },
22 }
23 savingPlanUtilizationOutput, err := client.GetSavingsPlansUtilization(context.TODO(), input)