How to use the heat.engine.attributes.Schema 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 / heat / test_resource.py View on Github external
default='',
            update_allowed=True
        ),
        ENTITY_NAME: properties.Schema(
            properties.Schema.STRING,
            _('Client entity to poll.'),
            default='',
            update_allowed=True
        ),
    }

    attributes_schema = {
        OUTPUT: attributes.Schema(
            _('The string that was stored. This value is '
              'also available by referencing the resource.'),
            cache_mode=attributes.Schema.CACHE_NONE
        ),
    }

    def _wait_secs(self):
        secs = None
        if self.properties[self.ACTION_WAIT_SECS]:
            secs = self.properties[self.ACTION_WAIT_SECS][self.action.lower()]
        if secs is None:
            secs = self.properties[self.WAIT_SECS]
        LOG.info('%(name)s wait_secs:%(wait)s, action:%(action)s',
                 {'name': self.name,
                  'wait': secs,
                  'action': self.action.lower()})
        return secs

    def handle_create(self):
github openstack / heat / heat / engine / resources / openstack / neutron / floatingip.py View on Github external
type=attributes.Schema.STRING
        ),
        FLOATING_NETWORK_ID_ATTR: attributes.Schema(
            _('ID of the network in which this IP is allocated.'),
            type=attributes.Schema.STRING
        ),
        FIXED_IP_ADDRESS_ATTR: attributes.Schema(
            _('IP address of the associated port, if specified.'),
            type=attributes.Schema.STRING,
            cache_mode=attributes.Schema.CACHE_NONE
        ),
        FLOATING_IP_ADDRESS_ATTR: attributes.Schema(
            _('The allocated address of this IP.'),
            type=attributes.Schema.STRING
        ),
        PORT_ID_ATTR: attributes.Schema(
            _('ID of the port associated with this IP.'),
            type=attributes.Schema.STRING,
            cache_mode=attributes.Schema.CACHE_NONE
        ),
    }

    def translation_rules(self, props):
        client_plugin = self.client_plugin()
        return [
            translation.TranslationRule(
                props,
                translation.TranslationRule.REPLACE,
                [self.FLOATING_NETWORK],
                value_path=[self.FLOATING_NETWORK_ID]
            ),
            translation.TranslationRule(
github openstack / heat / heat / engine / resources / openstack / heat / software_deployment.py View on Github external
properties.Schema.MAP,
            _('A map of names and server IDs to apply configuration to. The '
              'name is arbitrary and is used as the Heat resource name '
              'for the corresponding deployment.'),
            update_allowed=True,
            required=True
        ),
        CONFIG: _sd_ps[CONFIG],
        INPUT_VALUES: _sd_ps[INPUT_VALUES],
        DEPLOY_ACTIONS: _sd_ps[DEPLOY_ACTIONS],
        NAME: _sd_ps[NAME],
        SIGNAL_TRANSPORT: _sd_ps[SIGNAL_TRANSPORT]
    }

    attributes_schema = {
        STDOUTS: attributes.Schema(
            _("A map of Nova names and captured stdouts from the "
              "configuration execution to each server."),
            type=attributes.Schema.MAP
        ),
        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
        ),
    }
github infobloxopen / heat-infoblox / heat_infoblox / resources / netmri_job.py View on Github external
'a device ID.'),
                        constraints=[constraints.CustomConstraint('ip_addr')]
                    ),
                    NETWORK_VIEW: properties.Schema(
                        properties.Schema.STRING,
                        _('The network view name for this device IP. Required '
                          'if specifying an IP and there are multiple network '
                          'views in the NetMRI.')
                    ),
                })),
    }

    attributes_schema = {
        JOB: attributes.Schema(
            _('The job object as returned by the NetMRI API.'),
            attributes.Schema.MAP
        ),
        JOB_DETAILS: attributes.Schema(
            _('A list of targets with details about each.'),
            attributes.Schema.LIST
        )
    }

    @property
    def netmri(self):
        if not getattr(self, 'netmri_object', None):
            self.netmri_object = netmri.InfobloxNetMRI(
                self.properties[constants.CONNECTION]
            )
        return self.netmri_object

    def _device_ids(self):
github openstack / heat / heat / engine / resources / aws / autoscaling / autoscaling_group.py View on Github external
required=True
                    ),
                    TAG_VALUE: properties.Schema(
                        properties.Schema.STRING,
                        required=True
                    ),
                },
            )
        ),
    }

    attributes_schema = {
        INSTANCE_LIST: attributes.Schema(
            _("A comma-delimited list of server ip addresses. "
              "(Heat extension)."),
            type=attributes.Schema.STRING
        ),
    }

    rolling_update_schema = {
        MIN_INSTANCES_IN_SERVICE: properties.Schema(properties.Schema.INTEGER,
                                                    default=0),
        MAX_BATCH_SIZE: properties.Schema(properties.Schema.INTEGER,
                                          default=1),
        PAUSE_TIME: properties.Schema(properties.Schema.STRING,
                                      default='PT0S')
    }

    update_policy_schema = {
        ROLLING_UPDATE: properties.Schema(properties.Schema.MAP,
                                          schema=rolling_update_schema)
    }
github openstack / heat / heat / engine / resources / openstack / neutron / lbaas / listener.py View on Github external
_('The maximum number of connections permitted for this '
              'load balancer. Defaults to -1, which is infinite.'),
            update_allowed=True,
            default=-1,
            constraints=[
                constraints.Range(min=-1),
            ]
        ),
        TENANT_ID: properties.Schema(
            properties.Schema.STRING,
            _('The ID of the tenant who owns the listener.')
        ),
    }

    attributes_schema = {
        LOADBALANCERS_ATTR: attributes.Schema(
            _('ID of the load balancer this listener is associated to.'),
            type=attributes.Schema.LIST
        ),
        DEFAULT_POOL_ID_ATTR: attributes.Schema(
            _('ID of the default pool this listener is associated to.'),
            type=attributes.Schema.STRING
        )
    }

    def translation_rules(self, props):
        return [
            translation.TranslationRule(
                props,
                translation.TranslationRule.RESOLVE,
                [self.LOADBALANCER],
                client_plugin=self.client_plugin(),
github openstack / heat / heat / engine / resources / aws / ec2 / subnet.py View on Github external
TAG_KEY: properties.Schema(
                        properties.Schema.STRING,
                        required=True
                    ),
                    TAG_VALUE: properties.Schema(
                        properties.Schema.STRING,
                        required=True
                    ),
                },
                implemented=False,
            )
        ),
    }

    attributes_schema = {
        AVAILABILITY_ZONE: attributes.Schema(
            _('Availability Zone of the subnet.'),
            type=attributes.Schema.STRING
        ),
    }

    default_client_name = 'neutron'

    def handle_create(self):
        # TODO(sbaker) Verify that this CidrBlock is within the vpc CidrBlock
        network_id = self.properties.get(self.VPC_ID)

        props = {
            'network_id': network_id,
            'cidr': self.properties.get(self.CIDR_BLOCK),
            'name': self.physical_resource_name(),
            'ip_version': 4
github openstack / heat / heat / engine / resources / openstack / heat / remote_stack.py View on Github external
),
        TIMEOUT: properties.Schema(
            properties.Schema.INTEGER,
            _('Number of minutes to wait for this stack creation.'),
            update_allowed=True
        ),
        PARAMETERS: properties.Schema(
            properties.Schema.MAP,
            _('Set of parameters passed to this stack.'),
            default={},
            update_allowed=True
        ),
    }

    attributes_schema = {
        NAME_ATTR: attributes.Schema(
            _('Name of the stack.'),
            type=attributes.Schema.STRING
        ),
        OUTPUTS: attributes.Schema(
            _('A dict of key-value pairs output from the stack.'),
            type=attributes.Schema.MAP
        ),
    }

    def __init__(self, name, definition, stack):
        super(RemoteStack, self).__init__(name, definition, stack)
        self._region_name = None
        self._local_context = None
        self._ssl_verify = None
        self._cacert = None
github openstack / heat / heat / engine / resources / openstack / neutron / net.py View on Github external
}

    attributes_schema = {
        STATUS: attributes.Schema(
            _("The status of the network."),
            type=attributes.Schema.STRING
        ),
        NAME_ATTR: attributes.Schema(
            _("The name of the network."),
            type=attributes.Schema.STRING
        ),
        SUBNETS: attributes.Schema(
            _("Subnets of this network."),
            type=attributes.Schema.LIST
        ),
        ADMIN_STATE_UP_ATTR: attributes.Schema(
            _("The administrative status of the network."),
            type=attributes.Schema.STRING
        ),
        TENANT_ID_ATTR: attributes.Schema(
            _("The tenant owning this network."),
            type=attributes.Schema.STRING
        ),
        PORT_SECURITY_ENABLED_ATTR: attributes.Schema(
            _("Port security enabled of the network."),
            support_status=support.SupportStatus(version='5.0.0'),
            type=attributes.Schema.BOOLEAN
        ),
        MTU_ATTR: attributes.Schema(
            _("The maximum transmission unit size(in bytes) for the network."),
            support_status=support.SupportStatus(version='5.0.0'),
            type=attributes.Schema.INTEGER
github openstack / heat / heat / engine / resources / openstack / octavia / loadbalancer.py View on Github external
],
        ),
        FLAVOR: properties.Schema(
            properties.Schema.STRING,
            _('The name or ID of the flavor of the Load Balancer.'),
            support_status=support.SupportStatus(version='14.0.0'),
            constraints=[
                constraints.CustomConstraint('octavia.flavor')
            ]
        )
    }

    attributes_schema = {
        VIP_ADDRESS_ATTR: attributes.Schema(
            _('The VIP address of the LoadBalancer.'),
            type=attributes.Schema.STRING
        ),
        VIP_PORT_ATTR: attributes.Schema(
            _('The VIP port of the LoadBalancer.'),
            type=attributes.Schema.STRING
        ),
        VIP_SUBNET_ATTR: attributes.Schema(
            _('The VIP subnet of the LoadBalancer.'),
            type=attributes.Schema.STRING
        ),
        POOLS_ATTR: attributes.Schema(
            _('Pools this LoadBalancer is associated with.'),
            type=attributes.Schema.LIST,
        ),
        FLAVOR_ID_ATTR: attributes.Schema(
            _('The flavor ID of the LoadBalancer.'),
            type=attributes.Schema.STRING,