CreateSecurityGroup Creates a new security group on the API using the 'cf create-security-group'
(s resources.SecurityGroup)
| 26 | |
| 27 | // CreateSecurityGroup Creates a new security group on the API using the 'cf create-security-group' |
| 28 | func CreateSecurityGroup(s resources.SecurityGroup) { |
| 29 | dir, err := os.MkdirTemp("", "simple-security-group") |
| 30 | Expect(err).ToNot(HaveOccurred()) |
| 31 | defer os.RemoveAll(dir) |
| 32 | |
| 33 | tempfile := filepath.Join(dir, "security-group.json") |
| 34 | |
| 35 | securityGroup, err := json.Marshal(s.Rules) |
| 36 | Expect(err).ToNot(HaveOccurred()) |
| 37 | |
| 38 | err = os.WriteFile(tempfile, securityGroup, 0666) |
| 39 | Expect(err).ToNot(HaveOccurred()) |
| 40 | Eventually(CF("create-security-group", s.Name, tempfile)).Should(Exit(0)) |
| 41 | } |
| 42 | |
| 43 | // DeleteSecurityGroup Deletes a security group on the API using the 'cf delete-security-group' |
| 44 | func DeleteSecurityGroup(s resources.SecurityGroup) { |
no test coverage detected