How to use the heat.engine.resource function in heat

To help you get started, we’ve selected a few heat 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 openstack / heat / heat / engine / resources / openstack / keystone / role.py View on Github external
#
#    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 heat.common.i18n import _
from heat.engine import constraints
from heat.engine import properties
from heat.engine import resource
from heat.engine import support
from heat.engine import translation


class KeystoneRole(resource.Resource):
    """Heat Template Resource for Keystone Role.

    Roles dictate the level of authorization the end user can obtain. Roles can
    be granted at either the domain or project level. Role can be assigned to
    the individual user or at the group level. Role name is unique within the
    owning domain.
    """

    support_status = support.SupportStatus(
        version='2015.1',
        message=_('Supported versions: keystone v3'))

    default_client_name = 'keystone'

    entity = 'roles'
github openstack / heat / heat / scaling / cooldown.py View on Github external
def _log_and_raise_no_action(self, cooldown):
        LOG.info("Can not perform scaling action: "
                 "resource %(name)s is in cooldown (%(cooldown)s).",
                 {'name': self.name,
                  'cooldown': cooldown})
        reason = _('due to cooldown, '
                   'cooldown %s') % cooldown
        raise resource.NoActionRequired(
            res_name=self.name, reason=reason)
github openstack / heat / heat / engine / resources / openstack / heat / none_resource.py View on Github external
#         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.

import uuid

from heat.engine import properties
from heat.engine import resource
from heat.engine import support


class NoneResource(resource.Resource):
    """Enables easily disabling certain resources via the resource_registry.

    It does nothing, but can effectively stub out any other resource because it
    will accept any properties and return any attribute (as None). Note this
    resource always does nothing on update (e.g it is not replaced even if a
    change to the stubbed resource properties would cause replacement).
    """

    support_status = support.SupportStatus(version='5.0.0')
    properties_schema = {}
    attributes_schema = {}

    IS_PLACEHOLDER = 'is_placeholder'

    def _needs_update(self, after, before, after_props, before_props,
                      prev_resource, check_init_complete=True):
github openstack / heat / heat / engine / resources / openstack / sahara / image.py View on Github external
# 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 heat.common.i18n import _
from heat.engine import constraints
from heat.engine import properties
from heat.engine import resource
from heat.engine import support
from heat.engine import translation


class SaharaImageRegistry(resource.Resource):
    """A resource for registering an image in sahara.

    Allows to register an image in the sahara image registry and add tags.
    """

    support_status = support.SupportStatus(version='6.0.0')

    PROPERTIES = (
        IMAGE, USERNAME, DESCRIPTION, TAGS

    ) = (
        'image', 'username', 'description', 'tags'
    )

    properties_schema = {
        IMAGE: properties.Schema(
github openstack / heat / heat / engine / resources / openstack / nova / floatingip.py View on Github external
from oslo_log import log as logging
import six

from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import properties
from heat.engine import resource
from heat.engine import support

LOG = logging.getLogger(__name__)


class NovaFloatingIp(resource.Resource):
    """A resource for managing Nova floating IPs.

    Floating IP addresses can change their association between instances by
    action of the user. One of the most common use cases for floating IPs is
    to provide public IP addresses to a private cloud, where there are a
    limited number of IP addresses available. Another is for a public cloud
    user to have a "static" IP address that can be reassigned when an instance
    is upgraded or moved.
    """

    deprecation_msg = _('Please use OS::Neutron::FloatingIP instead.')
    support_status = support.SupportStatus(
        status=support.HIDDEN,
        message=deprecation_msg,
        version='11.0.0',
        previous_status=support.SupportStatus(
github infobloxopen / heat-infoblox / heat_infoblox / resources / nameserver_group_member.py View on Github external
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import properties
from heat.engine import resource
from heat.engine import support

from heat_infoblox import constants
from heat_infoblox import resource_utils

from oslo_concurrency import lockutils


LOG = logging.getLogger(__name__)


class NameServerGroupMember(resource.Resource):
    '''A resource which represents a name server group.

    Use this resource to create, modify, and delete name server groups in the
    grid.
    '''

    PROPERTIES = (
        GROUP_NAME, MEMBER_ROLE, MEMBER_SERVER, EXTERNAL_SERVER,
        MEMBER_NAME, GRID_REPLICATE, LEAD,
        ENABLE_PREFERRED_PRIMARIES, PREFERRED_PRIMARIES
    ) = (
        'group_name', 'member_role', 'member_server', 'external_server',
        'name', 'grid_replicate', 'lead',
        'enable_preferred_primaries', 'preferred_primaries'
    )
github F5Networks / f5-openstack-heat-plugins / f5_heat / resources / f5_sys_partition.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 heat.common import exception
from heat.common.i18n import _
from heat.engine import properties
from heat.engine import resource

from common.mixins import f5_bigip
from common.mixins import F5BigIPMixin


class F5SysPartition(resource.Resource, F5BigIPMixin):
    '''Manages creation of an F5® Partition Resource.'''

    PROPERTIES = (
        NAME,
        BIGIP_SERVER,
        NAME,
        SUBPATH
    ) = (
        'name',
        'bigip_server',
        'name',
        'subpath'
    )

    properties_schema = {
        NAME: properties.Schema(
github openstack / heat / heat / engine / resources / openstack / cinder / qos_specs.py View on Github external
#
#         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 heat.common.i18n import _
from heat.engine import properties
from heat.engine import resource
from heat.engine import support


class QoSSpecs(resource.Resource):
    """A resource for creating cinder QoS specs.

    Users can ask for a specific volume type. Part of that volume type is a
    string that defines the QoS of the volume IO (fast, normal, or slow).
    Backends that can handle all of the demands of the volume type become
    candidates for scheduling. Usage of this resource restricted to admins
    only by default policy.
    """

    support_status = support.SupportStatus(version='7.0.0')

    default_client_name = 'cinder'
    entity = 'qos_specs'
    required_service_extension = 'qos-specs'

    PROPERTIES = (
github openstack / heat / heat / engine / check_resource.py View on Github external
def check_resource_update(rsrc, template_id, resource_data, engine_id,
                          stack, msg_queue):
    """Create or update the Resource if appropriate."""
    check_message = functools.partial(_check_for_message, msg_queue)
    if rsrc.action == resource.Resource.INIT:
        rsrc.create_convergence(template_id, resource_data, engine_id,
                                stack.time_remaining(), check_message)
    else:
        rsrc.update_convergence(template_id, resource_data, engine_id,
                                stack.time_remaining(), stack,
                                check_message)
github openstack / heat / heat / engine / resources / openstack / neutron / loadbalancer.py View on Github external
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
        if prop_diff:
            self.client().update_member(
                self.resource_id, {'member': prop_diff})

    def handle_delete(self):
        try:
            self.client().delete_member(self.resource_id)
        except Exception as ex:
            self.client_plugin().ignore_not_found(ex)
        else:
            return True


class LoadBalancer(resource.Resource):
    """A resource to link a neutron pool with servers.

    A loadbalancer allows linking a neutron pool with specified servers to some
    port.
    """

    required_service_extension = 'lbaas'

    support_status = support.SupportStatus(
        support.DEPRECATED, DEPR_MSG, version='7.0.0',
        previous_status=support.SupportStatus(version='2014.1')
    )

    PROPERTIES = (
        POOL_ID, PROTOCOL_PORT, MEMBERS,
    ) = (