@@ -88,7 +88,7 @@ func (f *IBMPINetworkSecurityGroupClient) Delete(id string) error {
88
88
}
89
89
90
90
// Add a member to a network security group
91
- func (f * IBMPINetworkSecurityGroupClient ) AddMember (id string , body * models.NetworkSecurityGroupAddMember ) (* models.NetworkSecurityGroup , error ) {
91
+ func (f * IBMPINetworkSecurityGroupClient ) AddMember (id string , body * models.NetworkSecurityGroupAddMember ) (* models.NetworkSecurityGroupMember , error ) {
92
92
params := network_security_groups .NewV1NetworkSecurityGroupsMembersPostParams ().WithContext (f .ctx ).WithTimeout (helpers .PICreateTimeOut ).WithNetworkSecurityGroupID (id ).WithBody (body )
93
93
resp , err := f .session .Power .NetworkSecurityGroups .V1NetworkSecurityGroupsMembersPost (params , f .session .AuthInfo (f .cloudInstanceID ))
94
94
if err != nil {
@@ -101,20 +101,17 @@ func (f *IBMPINetworkSecurityGroupClient) AddMember(id string, body *models.Netw
101
101
}
102
102
103
103
// Deleta a member from a network securti group
104
- func (f * IBMPINetworkSecurityGroupClient ) DeleteMember (id , memberId string ) ( * models. NetworkSecurityGroup , error ) {
104
+ func (f * IBMPINetworkSecurityGroupClient ) DeleteMember (id , memberId string ) error {
105
105
params := network_security_groups .NewV1NetworkSecurityGroupsMembersDeleteParams ().WithContext (f .ctx ).WithTimeout (helpers .PIDeleteTimeOut ).WithNetworkSecurityGroupID (id ).WithNetworkSecurityGroupMemberID (memberId )
106
- resp , err := f .session .Power .NetworkSecurityGroups .V1NetworkSecurityGroupsMembersDelete (params , f .session .AuthInfo (f .cloudInstanceID ))
106
+ _ , err := f .session .Power .NetworkSecurityGroups .V1NetworkSecurityGroupsMembersDelete (params , f .session .AuthInfo (f .cloudInstanceID ))
107
107
if err != nil {
108
- return nil , ibmpisession .SDKFailWithAPIError (err , fmt .Errorf ("failed to delete member %s from network security group %s: %w" , memberId , id , err ))
108
+ return ibmpisession .SDKFailWithAPIError (err , fmt .Errorf ("failed to delete member %s from network security group %s: %w" , memberId , id , err ))
109
109
}
110
- if resp == nil || resp .Payload == nil {
111
- return nil , fmt .Errorf ("failed to delete member %s from network security group %s" , memberId , id )
112
- }
113
- return resp .Payload , nil
110
+ return nil
114
111
}
115
112
116
113
// Add a rule to a network security group
117
- func (f * IBMPINetworkSecurityGroupClient ) AddRule (id string , body * models.NetworkSecurityGroupAddRule ) (* models.NetworkSecurityGroup , error ) {
114
+ func (f * IBMPINetworkSecurityGroupClient ) AddRule (id string , body * models.NetworkSecurityGroupAddRule ) (* models.NetworkSecurityGroupRule , error ) {
118
115
params := network_security_groups .NewV1NetworkSecurityGroupsRulesPostParams ().WithContext (f .ctx ).WithTimeout (helpers .PICreateTimeOut ).WithNetworkSecurityGroupID (id ).WithBody (body )
119
116
resp , err := f .session .Power .NetworkSecurityGroups .V1NetworkSecurityGroupsRulesPost (params , f .session .AuthInfo (f .cloudInstanceID ))
120
117
if err != nil {
@@ -127,16 +124,13 @@ func (f *IBMPINetworkSecurityGroupClient) AddRule(id string, body *models.Networ
127
124
}
128
125
129
126
// Delete a rule from a network security group
130
- func (f * IBMPINetworkSecurityGroupClient ) DeleteRule (id , ruleId string ) ( * models. NetworkSecurityGroup , error ) {
127
+ func (f * IBMPINetworkSecurityGroupClient ) DeleteRule (id , ruleId string ) error {
131
128
params := network_security_groups .NewV1NetworkSecurityGroupsRulesDeleteParams ().WithContext (f .ctx ).WithTimeout (helpers .PIDeleteTimeOut ).WithNetworkSecurityGroupID (id ).WithNetworkSecurityGroupRuleID (ruleId )
132
- resp , err := f .session .Power .NetworkSecurityGroups .V1NetworkSecurityGroupsRulesDelete (params , f .session .AuthInfo (f .cloudInstanceID ))
129
+ _ , err := f .session .Power .NetworkSecurityGroups .V1NetworkSecurityGroupsRulesDelete (params , f .session .AuthInfo (f .cloudInstanceID ))
133
130
if err != nil {
134
- return nil , ibmpisession .SDKFailWithAPIError (err , fmt .Errorf ("failed to delete rule %s from network security group %s: %w" , ruleId , id , err ))
131
+ return ibmpisession .SDKFailWithAPIError (err , fmt .Errorf ("failed to delete rule %s from network security group %s: %w" , ruleId , id , err ))
135
132
}
136
- if resp == nil || resp .Payload == nil {
137
- return nil , fmt .Errorf ("failed to delete rule %s from network security group %s" , ruleId , id )
138
- }
139
- return resp .Payload , nil
133
+ return nil
140
134
}
141
135
142
136
// Action on a network security group
0 commit comments