How to use the pynetbox.lib.response.IPRecord function in pynetbox

To help you get started, we’ve selected a few pynetbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github digitalocean / pynetbox / pynetbox / ipam.py View on Github external
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''
from pynetbox.lib.response import IPRecord
from pynetbox.lib.endpoint import DetailEndpoint


class IpAddresses(IPRecord):

    def __str__(self):
        return str(self.address)


class Prefixes(IPRecord):

    def __str__(self):
        return str(self.prefix)

    @property
    def available_ips(self):
        """ Represents the ``available-ips`` detail endpoint.

        Returns a DetailEndpoint object that is the interface for
        viewing and creating IP addresses inside a prefix.

        :returns: :py:class:`.DetailEndpoint`

        :Examples:

        >>> prefix = nb.ipam.prefixes.get(24)
github digitalocean / pynetbox / pynetbox / ipam.py View on Github external
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''
from pynetbox.lib.response import IPRecord
from pynetbox.lib.endpoint import DetailEndpoint


class IpAddresses(IPRecord):

    def __str__(self):
        return str(self.address)


class Prefixes(IPRecord):

    def __str__(self):
        return str(self.prefix)

    @property
    def available_ips(self):
        """ Represents the ``available-ips`` detail endpoint.

        Returns a DetailEndpoint object that is the interface for
        viewing and creating IP addresses inside a prefix.
github digitalocean / pynetbox / pynetbox / ipam.py View on Github external
Creating a single child prefix:

        >>> prefix = nb.ipam.prefixes.get(1)
        >>> new_prefix = prefix.available_prefixes.create(
        ...    {'prefix_length': 29}
        ...)
        >>> new_prefix['prefix']
        u'10.1.1.56/29'

        '''
        return DetailEndpoint(self, 'available-prefixes')


class Aggregates(IPRecord):

    def __str__(self):
        return str(self.prefix)