Copilot commented on code in PR #352:
URL: 
https://github.com/apache/cloudstack-terraform-provider/pull/352#discussion_r4036419202


##########
cloudstack/resource_cloudstack_security_group_rule.go:
##########
@@ -240,6 +255,64 @@ func createSecurityGroupRules(d *schema.ResourceData, meta 
interface{}, rules *s
        return errs.ErrorOrNil()
 }
 
+func setSecurityGroupRuleOwnership(p authorizeSecurityGroupParams, sg 
*cloudstack.SecurityGroup) {
+       if sg.Projectid != "" {
+               p.SetProjectid(sg.Projectid)
+               return
+       }
+
+       if sg.Domainid != "" {
+               p.SetDomainid(sg.Domainid)
+
+               if sg.Account != "" {
+                       p.SetAccount(sg.Account)
+               }
+       }
+}
+
+func getSecurityGroupRuleSourceGroup(cs *cloudstack.CloudStackClient, targetSG 
*cloudstack.SecurityGroup, name string) (*cloudstack.SecurityGroup, error) {
+       p := cs.SecurityGroup.NewListSecurityGroupsParams()
+       p.SetSecuritygroupname(name)
+
+       if targetSG.Projectid != "" {
+               p.SetProjectid(targetSG.Projectid)
+       }
+
+       l, err := cs.SecurityGroup.ListSecurityGroups(p)
+       if err != nil {
+               return nil, err
+       }
+
+       if l.Count == 0 {
+               return nil, fmt.Errorf("No match found for security group %q", 
name)
+       }
+
+       if l.Count > 1 {
+               return nil, fmt.Errorf("There is more then one result for 
SecurityGroup name: %s", name)

Review Comment:
   The duplicate-result error says "more then one"; use "more than one" so the 
diagnostic is grammatically correct when duplicate security-group names are 
encountered.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to