use aws.StringSlice replace of deprecated func stringPointerArray
This commit is contained in:
parent
0c1f933693
commit
47c753aa18
@ -745,15 +745,6 @@ func (p *awsSDKProvider) KeyManagement(regionName string) (KMS, error) {
|
||||
return kmsClient, nil
|
||||
}
|
||||
|
||||
// stringPointerArray creates a slice of string pointers from a slice of strings
|
||||
// Deprecated: consider using aws.StringSlice - but note the slightly different behaviour with a nil input
|
||||
func stringPointerArray(orig []string) []*string {
|
||||
if orig == nil {
|
||||
return nil
|
||||
}
|
||||
return aws.StringSlice(orig)
|
||||
}
|
||||
|
||||
func newEc2Filter(name string, values ...string) *ec2.Filter {
|
||||
filter := &ec2.Filter{
|
||||
Name: aws.String(name),
|
||||
|
@ -912,9 +912,17 @@ func (c *Cloud) ensureLoadBalancer(namespacedName types.NamespacedName, loadBala
|
||||
|
||||
// We are supposed to specify one subnet per AZ.
|
||||
// TODO: What happens if we have more than one subnet per AZ?
|
||||
createRequest.Subnets = stringPointerArray(subnetIDs)
|
||||
if subnetIDs == nil {
|
||||
createRequest.Subnets = nil
|
||||
} else {
|
||||
createRequest.Subnets = aws.StringSlice(subnetIDs)
|
||||
}
|
||||
|
||||
createRequest.SecurityGroups = stringPointerArray(securityGroupIDs)
|
||||
if securityGroupIDs == nil {
|
||||
createRequest.SecurityGroups = nil
|
||||
} else {
|
||||
createRequest.SecurityGroups = aws.StringSlice(securityGroupIDs)
|
||||
}
|
||||
|
||||
// Get additional tags set by the user
|
||||
tags := getLoadBalancerAdditionalTags(annotations)
|
||||
@ -996,7 +1004,11 @@ func (c *Cloud) ensureLoadBalancer(namespacedName types.NamespacedName, loadBala
|
||||
// This call just replaces the security groups, unlike e.g. subnets (!)
|
||||
request := &elb.ApplySecurityGroupsToLoadBalancerInput{}
|
||||
request.LoadBalancerName = aws.String(loadBalancerName)
|
||||
request.SecurityGroups = stringPointerArray(securityGroupIDs)
|
||||
if securityGroupIDs == nil {
|
||||
request.SecurityGroups = nil
|
||||
} else {
|
||||
request.SecurityGroups = aws.StringSlice(securityGroupIDs)
|
||||
}
|
||||
glog.V(2).Info("Applying updated security groups to load balancer")
|
||||
_, err := c.elb.ApplySecurityGroupsToLoadBalancer(request)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user