class PaloAlto::XML::ArrayConfigClass

Attributes

selector[RW]

Public Instance Methods

move!(where:, dst: nil) click to toggle source
# File lib/palo_alto/config.rb, line 755
def move!(where:, dst: nil)
        payload = {
                type:              'config',
                action: 'move',
                xpath:     self.to_xpath,
                where: where
        }
        if dst
                payload[:dst] = dst
        end

        XML.execute(payload)
end
rename!(new_name) click to toggle source
# File lib/palo_alto/config.rb, line 778
def rename!(new_name)
        # https://docs.paloaltonetworks.com/pan-os/10-1/pan-os-panorama-api/pan-os-xml-api-request-types/configuration-api/rename-configuration.html
        payload = {
                type:              'config',
                action: 'rename',
                xpath:     self.to_xpath,
                newname: new_name
        }

        result = XML.execute(payload)

        # now update also the internal value to the new name
        self.selector.transform_values!{new_name}
        @external_values["@#{self.selector.keys.first}"] = new_name
        set_xpath_from_selector()
end
set_xpath_from_selector(selector: @selector) click to toggle source
# File lib/palo_alto/config.rb, line 769
def set_xpath_from_selector(selector: @selector)
        xpath = self.parent_instance.child(_section)
        k,v=selector.first
        obj = xpath.where(PaloAlto.xpath_attr(k.to_sym) == v)

        @expression = obj.expression
        @arguments = obj.arguments
end