Skip to content

Commit 4544834

Browse files
authored
Merge pull request #1196 from gargipanatula/remove-autoscaling-client
Cleanup unused autoscaling client
2 parents 3ffac90 + 255e680 commit 4544834

File tree

3 files changed

+0
-43
lines changed

3 files changed

+0
-43
lines changed

pkg/providers/v1/aws.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535
"github.com/aws/aws-sdk-go/aws/endpoints"
3636
"github.com/aws/aws-sdk-go/aws/request"
3737
"github.com/aws/aws-sdk-go/aws/session"
38-
"github.com/aws/aws-sdk-go/service/autoscaling"
3938
"github.com/aws/aws-sdk-go/service/ec2"
4039
"github.com/aws/aws-sdk-go/service/elb"
4140
"github.com/aws/aws-sdk-go/service/elbv2"
@@ -291,7 +290,6 @@ type Services interface {
291290
Compute(region string) (iface.EC2, error)
292291
LoadBalancing(region string) (ELB, error)
293292
LoadBalancingV2(region string) (ELBV2, error)
294-
Autoscaling(region string) (ASG, error)
295293
Metadata() (config.EC2Metadata, error)
296294
KeyManagement(region string) (KMS, error)
297295
}
@@ -355,13 +353,6 @@ type ELBV2 interface {
355353
WaitUntilLoadBalancersDeleted(*elbv2.DescribeLoadBalancersInput) error
356354
}
357355

358-
// ASG is a simple pass-through of the Autoscaling client interface, which
359-
// allows for testing.
360-
type ASG interface {
361-
UpdateAutoScalingGroup(*autoscaling.UpdateAutoScalingGroupInput) (*autoscaling.UpdateAutoScalingGroupOutput, error)
362-
DescribeAutoScalingGroups(*autoscaling.DescribeAutoScalingGroupsInput) (*autoscaling.DescribeAutoScalingGroupsOutput, error)
363-
}
364-
365356
// KMS is a simple pass-through of the Key Management Service client interface,
366357
// which allows for testing.
367358
type KMS interface {
@@ -379,7 +370,6 @@ type Cloud struct {
379370
ec2 iface.EC2
380371
elb ELB
381372
elbv2 ELBV2
382-
asg ASG
383373
kms KMS
384374
metadata config.EC2Metadata
385375
cfg *config.CloudConfig
@@ -614,11 +604,6 @@ func newAWSCloud2(cfg config.CloudConfig, awsServices Services, provider config.
614604
return nil, fmt.Errorf("error creating AWS ELBV2 client: %v", err)
615605
}
616606

617-
asg, err := awsServices.Autoscaling(regionName)
618-
if err != nil {
619-
return nil, fmt.Errorf("error creating AWS autoscaling client: %v", err)
620-
}
621-
622607
kms, err := awsServices.KeyManagement(regionName)
623608
if err != nil {
624609
return nil, fmt.Errorf("error creating AWS key management client: %v", err)
@@ -628,7 +613,6 @@ func newAWSCloud2(cfg config.CloudConfig, awsServices Services, provider config.
628613
ec2: ec2,
629614
elb: elb,
630615
elbv2: elbv2,
631-
asg: asg,
632616
metadata: metadata,
633617
kms: kms,
634618
cfg: &cfg,

pkg/providers/v1/aws_fakes.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,6 @@ func (s *FakeAWSServices) LoadBalancingV2(region string) (ELBV2, error) {
168168
return s.elbv2, nil
169169
}
170170

171-
// Autoscaling returns a fake ASG client
172-
func (s *FakeAWSServices) Autoscaling(region string) (ASG, error) {
173-
return s.asg, nil
174-
}
175-
176171
// Metadata returns a fake EC2Metadata client
177172
func (s *FakeAWSServices) Metadata() (config.EC2Metadata, error) {
178173
return s.metadata, nil

pkg/providers/v1/aws_sdk.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"github.com/aws/aws-sdk-go/aws/ec2metadata"
2626
"github.com/aws/aws-sdk-go/aws/request"
2727
"github.com/aws/aws-sdk-go/aws/session"
28-
"github.com/aws/aws-sdk-go/service/autoscaling"
2928
"github.com/aws/aws-sdk-go/service/ec2"
3029
"github.com/aws/aws-sdk-go/service/elb"
3130
"github.com/aws/aws-sdk-go/service/elbv2"
@@ -179,27 +178,6 @@ func (p *awsSDKProvider) LoadBalancingV2(regionName string) (ELBV2, error) {
179178
return elbClient, nil
180179
}
181180

182-
func (p *awsSDKProvider) Autoscaling(regionName string) (ASG, error) {
183-
awsConfig := &aws.Config{
184-
Region: &regionName,
185-
Credentials: p.creds,
186-
}
187-
awsConfig = awsConfig.WithCredentialsChainVerboseErrors(true).
188-
WithEndpointResolver(p.cfg.GetResolver())
189-
sess, err := session.NewSessionWithOptions(session.Options{
190-
Config: *awsConfig,
191-
SharedConfigState: session.SharedConfigEnable,
192-
})
193-
if err != nil {
194-
return nil, fmt.Errorf("unable to initialize AWS session: %v", err)
195-
}
196-
client := autoscaling.New(sess)
197-
198-
p.AddHandlers(regionName, &client.Handlers)
199-
200-
return client, nil
201-
}
202-
203181
func (p *awsSDKProvider) Metadata() (config.EC2Metadata, error) {
204182
sess, err := session.NewSession(&aws.Config{
205183
EndpointResolver: p.cfg.GetResolver(),

0 commit comments

Comments
 (0)