Skip to content

Commit

Permalink
Merge pull request microsoft#143 from nwoodmsft/master
Browse files Browse the repository at this point in the history
ApplyACLPolicy needs to allow multiple policies to be provided
  • Loading branch information
darstahl authored Sep 28, 2017
2 parents 4486bc2 + 08379cc commit 7db05c0
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions hnsendpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,24 @@ func (endpoint *HNSEndpoint) ContainerHotDetach(containerID string) error {
return modifyNetworkEndpoint(containerID, endpoint.Id, Remove)
}

// ApplyACLPolicy applies Acl Policy on the Endpoint
func (endpoint *HNSEndpoint) ApplyACLPolicy(policy *ACLPolicy) error {
// ApplyACLPolicy applies a set of ACL Policies on the Endpoint
func (endpoint *HNSEndpoint) ApplyACLPolicy(policies ...*ACLPolicy) error {
operation := "ApplyACLPolicy"
title := "HCSShim::HNSEndpoint::" + operation
logrus.Debugf(title+" id=%s", endpoint.Id)

jsonString, err := json.Marshal(policy)
if err != nil {
return err
for _, policy := range policies {
if policy == nil {
continue
}
jsonString, err := json.Marshal(policy)
if err != nil {
return err
}
endpoint.Policies = append(endpoint.Policies, jsonString)
}
endpoint.Policies[0] = jsonString
_, err = endpoint.Update()

_, err := endpoint.Update()
return err
}

Expand Down

0 comments on commit 7db05c0

Please # to comment.