How to use the heat.engine.properties 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 / domain.py View on Github external
entity = 'domains'

    PROPERTIES = (
        NAME, DESCRIPTION, ENABLED
    ) = (
        'name', 'description', 'enabled'
    )

    properties_schema = {
        NAME: properties.Schema(
            properties.Schema.STRING,
            _('The name of the domain.'),
            update_allowed=True
        ),
        DESCRIPTION: properties.Schema(
            properties.Schema.STRING,
            _('Description of keystone domain.'),
            update_allowed=True
        ),
        ENABLED: properties.Schema(
            properties.Schema.BOOLEAN,
            _('This domain is enabled or disabled.'),
            default=True,
            update_allowed=True
        )
    }

    def client(self):
        return super(KeystoneDomain, self).client().client

    def handle_create(self):
        name = (self.properties[self.NAME] or
github openstack / heat / heat / engine / resource.py View on Github external
def resource_to_template(cls, resource_type, template_type='cfn'):
        """Generate a provider template that mirrors the resource.

        :param resource_type: The resource type to be displayed in the template
        :param template_type: the template type to generate, cfn or hot.
        :returns: A template where the resource's properties_schema is mapped
            as parameters, and the resource's attributes_schema is mapped as
            outputs
        """

        props_schema = {}
        for name, schema_dict in cls.properties_schema.items():
            schema = properties.Schema.from_legacy(schema_dict)
            if schema.support_status.status != support.HIDDEN:
                props_schema[name] = schema

        params, props = (properties.Properties.
                         schema_to_parameters_and_properties(props_schema,
                                                             template_type))
        resource_name = cls.__name__
        outputs = attributes.Attributes.as_outputs(resource_name, cls,
                                                   template_type)
        description = 'Initial template of %s' % resource_name
        return cls.build_template_dict(resource_name, resource_type,
                                       template_type, params, props,
                                       outputs, description)
github openstack / heat / heat / engine / resources / openstack / senlin / cluster.py View on Github external
'INIT', 'ACTIVE', 'ERROR', 'WARNING',
        'CREATING', 'DELETING', 'UPDATING'
    )

    properties_schema = {
        PROFILE: properties.Schema(
            properties.Schema.STRING,
            _('The name or id of the Senlin profile.'),
            required=True,
            update_allowed=True,
            constraints=[
                constraints.CustomConstraint('senlin.profile')
            ]
        ),
        NAME: properties.Schema(
            properties.Schema.STRING,
            _('Name of the cluster. By default, physical resource name '
              'is used.'),
            update_allowed=True,
        ),
        DESIRED_CAPACITY: properties.Schema(
            properties.Schema.INTEGER,
            _('Desired initial number of resources in cluster.'),
            default=0,
            update_allowed=True,
        ),
        MIN_SIZE: properties.Schema(
            properties.Schema.INTEGER,
            _('Minimum number of resources in the cluster.'),
            default=0,
            update_allowed=True,
            constraints=[
github openstack / heat / heat / engine / resources / openstack / heat / software_deployment.py View on Github external
),
        STDERRS: attributes.Schema(
            _("A map of Nova names and captured stderrs from the "
              "configuration execution to each server."),
            type=attributes.Schema.MAP
        ),
        STATUS_CODES: attributes.Schema(
            _("A map of Nova names and returned status code from the "
              "configuration execution."),
            type=attributes.Schema.MAP
        ),
    }

    rolling_update_schema = {
        MAX_BATCH_SIZE: properties.Schema(
            properties.Schema.INTEGER,
            _('The maximum number of deployments to replace at once.'),
            constraints=[constraints.Range(min=1)],
            default=1),
        PAUSE_TIME: properties.Schema(
            properties.Schema.NUMBER,
            _('The number of seconds to wait between batches of '
              'updates.'),
            constraints=[constraints.Range(min=0)],
            default=0),
    }

    update_policy_schema = {
        resource_group.ResourceGroup.ROLLING_UPDATE: properties.Schema(
            properties.Schema.MAP,
            schema=rolling_update_schema,
            support_status=support.SupportStatus(version='7.0.0')
github openstack / heat / heat / engine / resources / wait_condition.py View on Github external
ATTRIBUTES = (
        DATA,
    ) = (
        'Data',
    )

    properties_schema = {
        HANDLE: properties.Schema(
            properties.Schema.STRING,
            _('A reference to the wait condition handle used to signal this '
              'wait condition.'),
            required=True
        ),
        TIMEOUT: properties.Schema(
            properties.Schema.NUMBER,
            _('The number of seconds to wait for the correct number of '
              'signals to arrive.'),
            required=True,
            constraints=[
                constraints.Range(1, 43200),
            ]
        ),
        COUNT: properties.Schema(
            properties.Schema.NUMBER,
            _('The number of success signals that must be received before '
              'the stack creation process continues.'),
            constraints=[
                constraints.Range(min=1),
            ],
            default=1,
            update_allowed=True
github openstack / heat / heat / engine / resources / openstack / aodh / gnocchi / alarm.py View on Github external
PROPERTIES = (
        METRIC, RESOURCE_ID, RESOURCE_TYPE
    ) = (
        'metric', 'resource_id', 'resource_type'
    )
    PROPERTIES += COMMON_GNOCCHI_PROPERTIES

    properties_schema = {
        METRIC: properties.Schema(
            properties.Schema.STRING,
            _('Metric name watched by the alarm.'),
            required=True,
            update_allowed=True
        ),
        RESOURCE_ID: properties.Schema(
            properties.Schema.STRING,
            _('Id of a resource.'),
            required=True,
            update_allowed=True
        ),
        RESOURCE_TYPE: properties.Schema(
            properties.Schema.STRING,
            _('Resource type.'),
            required=True,
            update_allowed=True
        ),
    }
    properties_schema.update(common_gnocchi_properties_schema)
    properties_schema.update(alarm_base.common_properties_schema)

    alarm_type = 'gnocchi_resources_threshold'
github infobloxopen / heat-infoblox / heat_infoblox / resources / ha_pair.py View on Github external
'node1_admin', 'node1_password', 'node2_admin', 'node2_password',
        'update_allowed_address_pairs'
    )

    ATTRIBUTES = (
        NAME_ATTR,
    ) = (
        'name',
    )

    support_status = support.SupportStatus(
        support.UNSUPPORTED,
        _('See support.infoblox.com for support.'))

    properties_schema = {
        NAME: properties.Schema(
            properties.Schema.STRING,
            _('Member name.')),
        VIP_PORT: resource_utils.port_schema(VIP_PORT, True),
        NODE1_HA_PORT: resource_utils.port_schema(NODE1_HA_PORT, True),
        NODE2_HA_PORT: resource_utils.port_schema(NODE2_HA_PORT, True),
        NODE1_LAN1_PORT: resource_utils.port_schema(NODE1_LAN1_PORT, True),
        NODE2_LAN1_PORT: resource_utils.port_schema(NODE2_LAN1_PORT, True),
        VIP_FLOATING_IP: properties.Schema(
            properties.Schema.STRING,
            _('VIP floating IP.'),
            required=True),
        NODE1_FLOATING_IP: properties.Schema(
            properties.Schema.STRING,
            _('Node1 floating IP.'),
            required=True),
        NODE2_FLOATING_IP: properties.Schema(
github openstack / heat / heat / engine / resources / openstack / neutron / extraroute.py View on Github external
ROUTER_ID, DESTINATION, NEXTHOP,
    ) = (
        'router_id', 'destination', 'nexthop',
    )

    properties_schema = {
        ROUTER_ID: properties.Schema(
            properties.Schema.STRING,
            description=_('The router id.'),
            required=True,
            constraints=[
                constraints.CustomConstraint('neutron.router')
            ]
        ),
        DESTINATION: properties.Schema(
            properties.Schema.STRING,
            description=_('Network in CIDR notation.'),
            required=True),
        NEXTHOP: properties.Schema(
            properties.Schema.STRING,
            description=_('Nexthop IP address.'),
            required=True)
    }

    def add_dependencies(self, deps):
        super(ExtraRoute, self).add_dependencies(deps)
        for resource in six.itervalues(self.stack):
            # depend on any RouterInterface in this template with the same
            # router_id as this router_id
            if resource.has_interface('OS::Neutron::RouterInterface'):
                try:
                    router_id = self.properties[self.ROUTER_ID]
github openstack / heat / heat / engine / resources / openstack / neutron / security_group_rule.py View on Github external
constraints=[
                constraints.AllowedValues(['IPv4', 'IPv6']),
            ]
        ),
        PORT_RANGE_MIN: properties.Schema(
            properties.Schema.INTEGER,
            _('The minimum port number in the range that is matched by the '
              'security group rule. If the protocol is TCP or UDP, this '
              'value must be less than or equal to the value of the '
              'port_range_max attribute. If the protocol is ICMP, this '
              'value must be an ICMP type.'),
            constraints=[
                constraints.Range(0, 65535)
            ]
        ),
        PORT_RANGE_MAX: properties.Schema(
            properties.Schema.INTEGER,
            _('The maximum port number in the range that is matched by the '
              'security group rule. The port_range_min attribute constrains '
              'the port_range_max attribute. If the protocol is ICMP, this '
              'value must be an ICMP code.'),
            constraints=[
                constraints.Range(0, 65535)
            ]
        ),
        PROTOCOL: properties.Schema(
            properties.Schema.STRING,
            _('The protocol that is matched by the security group rule. '
              'Allowed values are ah, dccp, egp, esp, gre, icmp, icmpv6, '
              'igmp, ipv6-encap, ipv6-frag, ipv6-icmp, ipv6-nonxt, ipv6-opts, '
              'ipv6-route, ospf, pgm, rsvp, sctp, tcp, udp, udplite, vrrp '
              'and integer representations [0-255].'),
github openstack / heat / heat / engine / resources / openstack / neutron / sfc / flow_classifier.py View on Github external
PROPERTIES = (
        NAME, DESCRIPTION, PROTOCOL, ETHERTYPE,
        SOURCE_IP_PREFIX, DESTINATION_IP_PREFIX, SOURCE_PORT_RANGE_MIN,
        SOURCE_PORT_RANGE_MAX, DESTINATION_PORT_RANGE_MIN,
        DESTINATION_PORT_RANGE_MAX, LOGICAL_SOURCE_PORT,
        LOGICAL_DESTINATION_PORT, L7_PARAMETERS,
    ) = (
        'name', 'description', 'protocol', 'ethertype',
        'source_ip_prefix', 'destination_ip_prefix',
        'source_port_range_min', 'source_port_range_max',
        'destination_port_range_min', 'destination_port_range_max',
        'logical_source_port', 'logical_destination_port', 'l7_parameters',
    )

    properties_schema = {
        NAME: properties.Schema(
            properties.Schema.STRING,
            _('Name of the Flow Classifier.'),
            update_allowed=True
        ),
        DESCRIPTION: properties.Schema(
            properties.Schema.STRING,
            _('Description for the Flow Classifier.'),
            update_allowed=True
        ),
        PROTOCOL: properties.Schema(
            properties.Schema.STRING,
            _('IP Protocol for the Flow Classifier.'),
            constraints=[
                constraints.AllowedValues(['tcp', 'udp', 'icmp']),
            ],
        ),