Skip to content

Commit cb840cd

Browse files
committed
Set policyName in DescribeScalingPolicies input request
1 parent cbf1a42 commit cb840cd

File tree

5 files changed

+27
-4
lines changed

5 files changed

+27
-4
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2023-05-15T22:45:51Z"
2+
build_date: "2023-06-26T18:59:44Z"
33
build_hash: 8f3ba427974fd6e769926778d54834eaee3b81a3
4-
go_version: go1.19
4+
go_version: go1.20.1
55
version: v0.26.1
66
api_directory_checksum: 81d152c4602b014d435a9ba3d716ed5112273013
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.44.93
99
generator_config_info:
10-
file_checksum: b2ac33cc79c75dfc65066ea3fca66ad781d4ae18
10+
file_checksum: e5f40f1e7ac3be9113553960bfcb5945c7c08ab7
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/generator.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ resources:
5050
code: rm.customSetLastModifiedTimeToCreationTime(ko)
5151
sdk_update_post_set_output:
5252
code: rm.customSetLastModifiedTimeToCurrentTime(ko)
53+
sdk_read_many_post_build_request:
54+
code: rm.customDescribeScalingPolicies(ctx, r, input)
5355
fields:
5456
ResourceID:
5557
is_primary_key: true

generator.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ resources:
5050
code: rm.customSetLastModifiedTimeToCreationTime(ko)
5151
sdk_update_post_set_output:
5252
code: rm.customSetLastModifiedTimeToCurrentTime(ko)
53+
sdk_read_many_post_build_request:
54+
code: rm.customDescribeScalingPolicies(ctx, r, input)
5355
fields:
5456
ResourceID:
5557
is_primary_key: true

pkg/resource/scaling_policy/custom_api.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
package scaling_policy
1515

1616
import (
17+
"context"
18+
"time"
19+
1720
svcapitypes "github.com/aws-controllers-k8s/applicationautoscaling-controller/apis/v1alpha1"
21+
svcsdk "github.com/aws/aws-sdk-go/service/applicationautoscaling"
1822
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
19-
"time"
2023
)
2124

2225
// customSetLastModifiedTimeToCreationTime sets the LastModifiedTime field to the creationTime
@@ -31,3 +34,18 @@ func (rm *resourceManager) customSetLastModifiedTimeToCurrentTime(ko *svcapitype
3134
currentTime := metav1.Time{Time: time.Now().UTC()}
3235
ko.Status.LastModifiedTime = &currentTime
3336
}
37+
38+
// customDescribeScalingPolicies sets the policy name in DescribeScalingPoliciesInput
39+
func (rm *resourceManager) customDescribeScalingPolicies(
40+
ctx context.Context,
41+
latest *resource,
42+
input *svcsdk.DescribeScalingPoliciesInput,
43+
) {
44+
spec := latest.ko.Spec
45+
46+
var policyNames []*string
47+
if spec.PolicyName != nil {
48+
policyNames = append(policyNames, spec.ResourceID)
49+
input.SetPolicyNames(policyNames)
50+
}
51+
}

pkg/resource/scaling_policy/sdk.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)