Skip to content

Commit a3053eb

Browse files
committed
Adding support for GetSecurityGroupByName
Signed-off-by: Sameer Shaikh <[email protected]>
1 parent e887726 commit a3053eb

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

common/messages/messages_en.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,28 +175,28 @@ var messagesEn = map[string]util.Message{
175175
Description: "Unable to fetch list of subnet.",
176176
Type: util.RetrivalFailed,
177177
RC: 500,
178-
Action: "Unable to list subnet. Run 'ibmcloud is subnets' to list available subnets in your account.",
178+
Action: "Unable to list subnet. Target to appropriate region 'ibmcloud target -r <region>' and verify if 'ibmcloud is subnets' is returning the subnets. If it is not returning then raise ticket for VPC team else raise ticket for IKS team.",
179179
},
180180
"SubnetFindFailedWithZoneAndSubnetID": {
181181
Code: "SubnetFindFailedWithZoneAndSubnetID",
182182
Description: "A subnet with the specified zone '%s' and available cluster subnet list '%s' could not be found.",
183183
Type: util.RetrivalFailed,
184184
RC: 404,
185-
Action: "Verify that the subnet from the cluster subnet list exists. Run 'ibmcloud is subnets' to list available subnets in your account.",
185+
Action: "Verify that the subnet from the cluster subnet list exists. Target to appropriate region 'ibmcloud target -r <region>' and verify if 'ibmcloud is subnets' is returning the subnets. If it is not returning the matching subnet from the cluster subnet list then raise ticket for VPC team else raise ticket for IKS team.",
186186
},
187187
"ListSecurityGroupsFailed": {
188188
Code: "ListSecurityGroupsFailed",
189189
Description: "Unable to fetch list of securityGroup.",
190190
Type: util.RetrivalFailed,
191191
RC: 500,
192-
Action: "Unable to list securityGroup. Run 'ibmcloud is securityGroups' to list available securityGroups in your account.",
192+
Action: "Unable to list securityGroup. Target to appropriate region 'ibmcloud target -r <region>' and verify if 'ibmcloud is securityGroups' is returning the securityGroups. If it is not returning then raise ticket for VPC team else raise ticket for IKS team.",
193193
},
194194
"SecurityGroupFindFailedWithVPCAndSecurityGroupName": {
195195
Code: "SecurityGroupFindFailedWithVPCAndSecurityGroupName",
196196
Description: "A securityGroup with the specified cluster securityGroup name '%s' could not be found.",
197197
Type: util.RetrivalFailed,
198198
RC: 404,
199-
Action: "Verify that the securityGroup from the cluster securityGroup list exists. Run 'ibmcloud is securityGroups' to list available securityGroups in your account.",
199+
Action: "Verify that the cluster securityGroup exists. Target to appropriate region 'ibmcloud target -r <region>' and verify if 'ibmcloud is securityGroups' is returning the securityGroups. Please provide the output and raise ticket for IKS team.",
200200
},
201201
"ListVolumesFailed": {
202202
Code: "ListVolumesFailed",

file/provider/get_security_group.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,19 @@ func (vpcs *VPCSession) getSecurityGroupByVPCAndSecurityGroupName(securityGroupR
7777
startUrl, err := url.Parse(securityGroups.Next.Href)
7878
if err != nil {
7979
// API call is failed
80-
vpcs.Logger.Error("The next parameter of the securityGroup list could not be parsed.", zap.Reflect("Next", securityGroups.Next.Href), zap.Error(err))
80+
vpcs.Logger.Warn("The next parameter of the securityGroup list could not be parsed.", zap.Reflect("Next", securityGroups.Next.Href), zap.Error(err))
8181
return "", userError.GetUserError(string("SecurityGroupFindFailedWithVPCAndSecurityGroupName"), err, securityGroupRequest.Name)
8282
}
8383

8484
vpcs.Logger.Info("startUrl", zap.Reflect("startUrl", startUrl))
8585
start = startUrl.Query().Get("start") //parse query param into map
8686
if start == "" {
8787
// API call is failed
88-
vpcs.Logger.Error("The start specified in the next parameter of the securityGroup list is empty.", zap.Reflect("startUrl", startUrl))
88+
vpcs.Logger.Warn("The start specified in the next parameter of the securityGroup list is empty.", zap.Reflect("startUrl", startUrl))
8989
return "", userError.GetUserError(string("SecurityGroupFindFailedWithVPCAndSecurityGroupName"), errors.New("no securityGroup found"), securityGroupRequest.Name)
9090
}
91-
91+
} else {
92+
return "", userError.GetUserError(string("ListSecurityGroupsFailed"), errors.New("SecurityGroup list is empty"))
9293
}
9394
}
9495

file/provider/get_subnet.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,19 @@ func (vpcs *VPCSession) getSubnetByZoneAndSubnetID(subnetRequest provider.Subnet
7878
startUrl, err := url.Parse(subnets.Next.Href)
7979
if err != nil {
8080
// API call is failed
81-
vpcs.Logger.Error("The next parameter of the subnet list could not be parsed.", zap.Reflect("Next", subnets.Next.Href), zap.Error(err))
81+
vpcs.Logger.Warn("The next parameter of the subnet list could not be parsed.", zap.Reflect("Next", subnets.Next.Href), zap.Error(err))
8282
return "", userError.GetUserError(string("SubnetFindFailedWithZoneAndSubnetID"), err, subnetRequest.ZoneName, subnetRequest.SubnetIDList)
8383
}
8484

8585
vpcs.Logger.Info("startUrl", zap.Reflect("startUrl", startUrl))
8686
start = startUrl.Query().Get("start") //parse query param into map
8787
if start == "" {
8888
// API call is failed
89-
vpcs.Logger.Error("The start specified in the next parameter of the subnet list is empty.", zap.Reflect("start", startUrl))
89+
vpcs.Logger.Warn("The start specified in the next parameter of the subnet list is empty.", zap.Reflect("start", startUrl))
9090
return "", userError.GetUserError(string("SubnetFindFailedWithZoneAndSubnetID"), errors.New("no subnet found"), subnetRequest.ZoneName, subnetRequest.SubnetIDList)
9191
}
92-
92+
} else {
93+
return "", userError.GetUserError(string("ListSubnetsFailed"), errors.New("Subnet list is empty"))
9394
}
9495
}
9596

0 commit comments

Comments
 (0)