示例#1
0
        public void SetGroupMembership(GroupFirewallObject firewallGroupObject)
        {
            var response = commandFactory.CreateSetMembership(firewallGroupObject).Execute();

            if (!response.Status.Equals("success"))
            {
                throw new Exception(string.Format("Set Membership Method failed. PANOS error code {0}", response.Status));
            }
        }
示例#2
0
        public void InflateMembers <T, TDeserializer>(
            ISearchableRepository <T> searchableRepository,
            GroupFirewallObject groupFirewallObject,
            ConfigTypes configType) where T : FirewallObject where TDeserializer : ApiResponseForGetAll
        {
            var allTObjects = searchableRepository.GetAll <TDeserializer>(configType);

            groupFirewallObject.MemberObjects.AddRange(
                (from tObject in allTObjects
                 where groupFirewallObject.Members.Contains(tObject.Key)
                 select tObject.Value)
                .ToList());
        }
 public FormUrlEncodedContent CreateSetMembership(GroupFirewallObject groupFirewallObject)
 {
     return(new FormUrlEncodedContent(new[]
     {
         accessTokenPair,
         typeConfigPair,
         new KeyValuePair <string, string>("action", "edit"),
         new KeyValuePair <string, string>(
             "xpath",
             string.Format(
                 "/config/devices/entry/vsys/entry[@name='{0}']/{1}/entry[@name='{2}']",
                 vsys,
                 groupFirewallObject.SchemaName,
                 groupFirewallObject.Name)),
         new KeyValuePair <string, string>("element", groupFirewallObject.StaticMembershipSetRequestAsXml())
     }));
 }