MCPcopy
hub / github.com/cloudfoundry/cli / CreateSecurityGroup

Function CreateSecurityGroup

integration/helpers/security_group.go:28–41  ·  view source on GitHub ↗

CreateSecurityGroup Creates a new security group on the API using the 'cf create-security-group'

(s resources.SecurityGroup)

Source from the content-addressed store, hash-verified

26
27// CreateSecurityGroup Creates a new security group on the API using the 'cf create-security-group'
28func 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'
44func DeleteSecurityGroup(s resources.SecurityGroup) {

Calls 1

CFFunction · 0.85

Tested by

no test coverage detected