How to use the cloudbridge.cloud.interfaces.resources.CloudResource function in cloudbridge

To help you get started, we’ve selected a few cloudbridge 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 CloudVE / cloudbridge / cloudbridge / cloud / interfaces / resources.py View on Github external
least one placement zone.
    """
    __metaclass__ = ABCMeta

    @abstractproperty
    def zones(self):
        """
        Access information about placement zones within this region.

        :rtype: Iterable
        :return: Iterable of available placement zones in this region.
        """
        pass


class PlacementZone(CloudResource):
    """
    Represents a placement zone.

    A placement zone is contained within a Region.
    """
    __metaclass__ = ABCMeta

    @abstractproperty
    def region_name(self):
        """
        A region this placement zone is associated with.

        :rtype: ``str``
        :return: The id of the region the zone is associated with.
        """
        pass
github CloudVE / cloudbridge / cloudbridge / cloud / interfaces / resources.py View on Github external
:rtype: An object of :class:`.VMFirewallRuleSubService`
        :return: A VMFirewallRuleSubService for further operations
        """
        pass


class TrafficDirection(Enum):
    """
    Direction of data flow in a firewall.
    """
    INBOUND = 'inbound'
    OUTBOUND = 'outbound'


class VMFirewallRule(CloudResource):
    """
    Represents a VM firewall rule.
    """
    __metaclass__ = ABCMeta

    @abstractproperty
    def direction(self):
        """
        Direction of traffic to which this rule applies.

        Either ``TrafficDirection.INBOUND`` or ``TrafficDirection.OUTBOUND``.

        :rtype: ``str``
        :return: Direction of traffic to which this rule applies.
        """
        pass
github CloudVE / cloudbridge / cloudbridge / cloud / interfaces / resources.py View on Github external
property. In Azure, it also happens to be the same as the id property.

        The name property and the label property share the same character
        restrictions. see :py:attr:`~LabeledCloudResource.label`
        """
        pass

    @abstractmethod
    def to_json(self):
        """
        Returns a JSON representation of the CloudResource object.
        """
        pass


class LabeledCloudResource(CloudResource):

    @abstractproperty
    def label(self):
        """
        Get the resource label.

        The label property is a user-defined, editable identifier for a
        resource. It will often correspond to a user editable resource label
        in the underlying cloud provider, or be simulated through tags/labels.

        The label property adheres to the following restrictions:
        * Labels cannot be longer than 63 characters.
        * May only contain ascii characters comprising of lowercase letters,
          numeric characters, and dashes.
        * Must begin with an alphanumeric character and end with one
          (i.e. cannot begin or end with a dash)
github CloudVE / cloudbridge / cloudbridge / cloud / interfaces / resources.py View on Github external
VM firewall given access permissions by this rule.

        :rtype: :class:``.VMFirewall``
        :return: The VM firewall granted access.
        """
        pass

    @abstractmethod
    def delete(self):
        """
        Delete this rule.
        """
        pass


class BucketObject(CloudResource):
    """
    Represents an object stored within a bucket.
    """
    __metaclass__ = ABCMeta

    @abstractproperty
    def name(self):
        """
        Retrieve the name of the current object.

        The bucket object name adheres to a naming requirement that is more
        relaxed than the naming requirement enforced across CloudBridge. More
        details are available here: http://docs.aws.amazon.com/AmazonS3/latest/
        dev/UsingMetadata.html#object-key-guidelines

        :rtype: ``str``
github CloudVE / cloudbridge / cloudbridge / cloud / interfaces / resources.py View on Github external
:return: Unencrypted private key or ``None`` if not available.
        """
        pass

    @abstractmethod
    def delete(self):
        """
        Delete this key pair.

        :rtype: ``bool``
        :return: ``True`` if successful.
        """
        pass


class Region(CloudResource):
    """
    Represents a cloud region.

    A cloud region is typically a separate geographic area and will contain at
    least one placement zone.
    """
    __metaclass__ = ABCMeta

    @abstractproperty
    def zones(self):
        """
        Access information about placement zones within this region.

        :rtype: Iterable
        :return: Iterable of available placement zones in this region.
        """
github CloudVE / cloudbridge / cloudbridge / cloud / interfaces / resources.py View on Github external
least one placement zone.
    """
    __metaclass__ = ABCMeta

    @abstractproperty
    def zones(self):
        """
        Access information about placement zones within this region.

        :rtype: Iterable
        :return: Iterable of available placement zones in this region.
        """
        pass


class PlacementZone(CloudResource):
    """
    Represents a placement zone.

    A placement zone is contained within a Region.
    """
    __metaclass__ = ABCMeta

    @abstractproperty
    def region_name(self):
        """
        A region this placement zone is associated with.

        :rtype: ``str``
        :return: The id of the region the zone is associated with.
        """
        pass
github CloudVE / cloudbridge / cloudbridge / cloud / interfaces / resources.py View on Github external
A placement zone is contained within a Region.
    """
    __metaclass__ = ABCMeta

    @abstractproperty
    def region_name(self):
        """
        A region this placement zone is associated with.

        :rtype: ``str``
        :return: The id of the region the zone is associated with.
        """
        pass


class VMType(CloudResource):
    """
    A VM type object.
    """
    __metaclass__ = ABCMeta

    @abstractproperty
    def family(self):
        """
        The family/group that this VM type belongs to.

        For example, General Purpose Instances or High-Memory Instances. If
        the provider does not support such a grouping, it may return ``None``.

        :rtype: ``str``
        :return: Name of the instance family or ``None``.
        """
github CloudVE / cloudbridge / cloudbridge / cloud / interfaces / resources.py View on Github external
A placement zone is contained within a Region.
    """
    __metaclass__ = ABCMeta

    @abstractproperty
    def region_name(self):
        """
        A region this placement zone is associated with.

        :rtype: ``str``
        :return: The id of the region the zone is associated with.
        """
        pass


class VMType(CloudResource):
    """
    A VM type object.
    """
    __metaclass__ = ABCMeta

    @abstractproperty
    def family(self):
        """
        The family/group that this VM type belongs to.

        For example, General Purpose Instances or High-Memory Instances. If
        the provider does not support such a grouping, it may return ``None``.

        :rtype: ``str``
        :return: Name of the instance family or ``None``.
        """
github galaxyproject / cloudlaunch / django-cloudlaunch / baselaunch / drf_helpers.py View on Github external
def to_representation(self, value):
        """
        Returns the primary key value of the object.
        (Will be rendered in html by DRF as:
        <option value="$to_representation(instance)">#display_value(instance)
        </option>).
        """
        if isinstance(value, CloudResource):
            return value.id
        else:
            return value