How to use the heat.engine.attributes 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 / sahara / cluster.py View on Github external
constraints.AllowedValues(['rw', 'ro']),
                        ],
                        default='rw'
                    )
                }
            ),
            support_status=support.SupportStatus(version='6.0.0')
        )
    }

    attributes_schema = {
        STATUS: attributes.Schema(
            _("Cluster status."),
            type=attributes.Schema.STRING
        ),
        INFO: attributes.Schema(
            _("Cluster information."),
            type=attributes.Schema.MAP
        ),
    }

    default_client_name = 'sahara'

    entity = 'clusters'

    def translation_rules(self, props):
        rules = [
            translation.TranslationRule(
                props,
                translation.TranslationRule.REPLACE,
                [self.IMAGE_ID],
                value_path=[self.IMAGE]),
github openstack / heat / heat / engine / resources / openstack / swift / container.py View on Github external
version='2015.1')
        ),
    }

    attributes_schema = {
        DOMAIN_NAME: attributes.Schema(
            _('The host from the container URL.'),
            type=attributes.Schema.STRING
        ),
        WEBSITE_URL: attributes.Schema(
            _('The URL of the container.'),
            type=attributes.Schema.STRING
        ),
        ROOT_URL: attributes.Schema(
            _('The parent URL of the container.'),
            type=attributes.Schema.STRING
        ),
        OBJECT_COUNT: attributes.Schema(
            _('The number of objects stored in the container.'),
            type=attributes.Schema.INTEGER
        ),
        BYTES_USED: attributes.Schema(
            _('The number of bytes stored in the container.'),
            type=attributes.Schema.INTEGER
        ),
        HEAD_CONTAINER: attributes.Schema(
            _('A map containing all headers for the container.'),
            type=attributes.Schema.MAP
        ),
    }

    default_client_name = 'swift'
github openstack / heat / heat / engine / resources / openstack / neutron / lbaas / listener.py View on Github external
]
        ),
        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(),
                finder='find_resourceid_by_name_or_id',
                entity='loadbalancer'
            ),
        ]

    def validate(self):
github Juniper / contrail-heat / contrail_heat / resources / port_tuple.py View on Github external
required=True,
            update_allowed=False
        ),
    }

    attributes_schema = {
        "name": attributes.Schema(
            _('The name of the Port Tuple.'),
        ),
        "fq_name": attributes.Schema(
            _('The FQ name of the Port Tuple.'),
        ),
        "service_instance": attributes.Schema(
            _('Service Instance for the Port Tuple.'),
        ),
        "ports": attributes.Schema(
            _('Service interfaces for the Port Tuple.'),
        ),
        "tenant_id": attributes.Schema(
            _('Tenant id of the Service Instance.'),
        ),
        "show": attributes.Schema(
            _('All attributes.'),
        ),
    }

    update_allowed_keys = ('Properties',)

    @contrail.set_auth_token
    def handle_create(self):
        tenant_id = self.stack.context.tenant_id
        project_obj = self.vnc_lib().project_read(id=str(uuid.UUID(tenant_id)))
github openstack / heat / heat / engine / resources / openstack / nova / keypair.py View on Github external
'property is limited to being used by administrators only. '
              'Supported since Nova api version 2.10.'),
            constraints=[constraints.CustomConstraint('keystone.user')],
            support_status=support.SupportStatus(version='9.0.0')
        ),
    }

    attributes_schema = {
        PUBLIC_KEY_ATTR: attributes.Schema(
            _('The public key.'),
            type=attributes.Schema.STRING
        ),
        PRIVATE_KEY_ATTR: attributes.Schema(
            _('The private key if it has been saved.'),
            cache_mode=attributes.Schema.CACHE_NONE,
            type=attributes.Schema.STRING
        ),
    }

    default_client_name = 'nova'

    entity = 'keypairs'

    def __init__(self, name, json_snippet, stack):
        super(KeyPair, self).__init__(name, json_snippet, stack)
        self._public_key = None

    def translation_rules(self, props):
        return [
            translation.TranslationRule(
                props,
                translation.TranslationRule.RESOLVE,
github openstack / heat / heat / engine / resources / openstack / neutron / port.py View on Github external
PROPAGATE_UPLINK_STATUS: properties.Schema(
            properties.Schema.BOOLEAN,
            _('Flag to enable/disable propagate uplink status on the port.'),
            update_allowed=True,
            support_status=support.SupportStatus(version='15.0.0')
        ),
    }

    # Need to update properties_schema with other properties before
    # initialisation, because resource should contain all properties before
    # creating. Also, documentation should correctly resolves resource
    # properties schema.
    properties_schema.update(extra_properties_schema)

    attributes_schema = {
        ADMIN_STATE_UP_ATTR: attributes.Schema(
            _("The administrative state of this port."),
            type=attributes.Schema.STRING
        ),
        DEVICE_ID_ATTR: attributes.Schema(
            _("Unique identifier for the device."),
            type=attributes.Schema.STRING
        ),
        DEVICE_OWNER: attributes.Schema(
            _("Name of the network owning the port."),
            type=attributes.Schema.STRING
        ),
        FIXED_IPS_ATTR: attributes.Schema(
            _("Fixed IP addresses."),
            type=attributes.Schema.LIST
        ),
        MAC_ADDRESS_ATTR: attributes.Schema(
github openstack / heat / contrib / rackspace / rackspace / resources / cloud_loadbalancer.py View on Github external
"301 (Moved Permanently), and the requester is redirected to "
              "the requested URL via the HTTPS protocol on port 443. Only "
              "available for HTTPS protocol (port=443), or HTTP protocol with "
              "a properly configured SSL termination (secureTrafficOnly=true, "
              "securePort=443)."),
            update_allowed=True,
            default=False,
            support_status=support.SupportStatus(version="2015.1")
        )
    }

    attributes_schema = {
        PUBLIC_IP: attributes.Schema(
            _('Public IP address of the specified instance.')
        ),
        VIPS: attributes.Schema(
            _("A list of assigned virtual ip addresses")
        )
    }

    ACTIVE_STATUS = 'ACTIVE'
    DELETED_STATUS = 'DELETED'
    PENDING_DELETE_STATUS = 'PENDING_DELETE'
    PENDING_UPDATE_STATUS = 'PENDING_UPDATE'

    def __init__(self, name, json_snippet, stack):
        super(CloudLoadBalancer, self).__init__(name, json_snippet, stack)
        self.clb = self.cloud_lb()

    def cloud_lb(self):
        return self.client('cloud_lb')
github openstack / heat / heat / engine / resources / openstack / designate / zone.py View on Github external
support_status=support.SupportStatus(
                status=support.DEPRECATED,
                version='15.0.0',
                message=_('Use ``primaries`` instead.')
            )
        ),
        PRIMARIES: properties.Schema(
            properties.Schema.LIST,
            _('The primary servers to transfer DNS zone information from. '
              'Mandatory for zone type SECONDARY, otherwise ignored.'),
            update_allowed=True
        ),
    }

    attributes_schema = {
        SERIAL: attributes.Schema(
            _("DNS zone serial number."),
            type=attributes.Schema.STRING
        ),
    }

    default_client_name = 'designate'

    entity = 'zones'

    def validate(self):
        super(DesignateZone, self).validate()

        def raise_invalid_exception(zone_type, prp):
            if self.properties.get(self.TYPE) == zone_type:
                if not self.properties.get(prp):
                    msg = _('Property %(prp)s is required for zone type '
github openstack / heat / heat / engine / resources / openstack / heat / autoscaling_group.py View on Github external
_('The number of seconds to wait between batches of '
                      'updates.'),
                    constraints=[constraints.Range(min=0)],
                    default=0),
            },
            # A default policy has all fields with their own default values.
            default={
                MIN_IN_SERVICE: 0,
                MAX_BATCH_SIZE: 1,
                PAUSE_TIME: 0,
            },
        ),
    }

    attributes_schema = {
        OUTPUTS: attributes.Schema(
            _("A map of resource names to the specified attribute of each "
              "individual resource that is part of the AutoScalingGroup. "
              "This map specifies output parameters that are available "
              "once the AutoScalingGroup has been instantiated."),
            support_status=support.SupportStatus(version='2014.2'),
            type=attributes.Schema.MAP
        ),
        OUTPUTS_LIST: attributes.Schema(
            _("A list of the specified attribute of each individual resource "
              "that is part of the AutoScalingGroup. This list of attributes "
              "is available as an output once the AutoScalingGroup has been "
              "instantiated."),
            support_status=support.SupportStatus(version='2014.2'),
            type=attributes.Schema.LIST
        ),
        CURRENT_SIZE: attributes.Schema(
github openstack / heat / heat / engine / resources / openstack / senlin / cluster.py View on Github external
constraints=[
                            constraints.CustomConstraint('senlin.policy')
                        ]
                    ),
                    P_ENABLED: properties.Schema(
                        properties.Schema.BOOLEAN,
                        _("Whether enable this policy on this cluster."),
                        default=True,
                    ),
                }
            )
        ),
    }

    attributes_schema = {
        ATTR_NAME: attributes.Schema(
            _("Cluster name."),
            type=attributes.Schema.STRING
        ),
        ATTR_METADATA: attributes.Schema(
            _("Cluster metadata."),
            type=attributes.Schema.MAP
        ),
        ATTR_DESIRED_CAPACITY: attributes.Schema(
            _("Desired capacity of the cluster."),
            type=attributes.Schema.INTEGER
        ),
        ATTR_NODES: attributes.Schema(
            _("Nodes list in the cluster."),
            type=attributes.Schema.LIST,
            cache_mode=attributes.Schema.CACHE_NONE
        ),