Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from heat.engine.resources.openstack.neutron import neutron
from heat.engine import support
from heat.engine import translation
class PortChain(neutron.NeutronResource):
"""A resource for neutron networking-sfc.
This resource used to define the service function path by arranging
networking-sfc port-pair-groups and set of flow classifiers, to specify
the classified traffic flows to enter the chain.
"""
support_status = support.SupportStatus(
version='8.0.0',
status=support.UNSUPPORTED)
required_service_extension = 'sfc'
PROPERTIES = (
NAME, DESCRIPTION, PORT_PAIR_GROUPS, FLOW_CLASSIFIERS,
CHAIN_PARAMETERS,
) = (
'name', 'description', 'port_pair_groups',
'flow_classifiers', 'chain_parameters',
)
properties_schema = {
NAME: properties.Schema(
properties.Schema.STRING,
_('Name of the Port Chain.'),
update_allowed=True
class L2Gateway(neutron.NeutronResource):
"""A resource for managing Neutron L2 Gateways.
The are a number of use cases that can be addressed by an L2 Gateway API.
Most notably in cloud computing environments, a typical use case is
bridging the virtual with the physical. Translate this to Neutron and the
OpenStack world, and this means relying on L2 Gateway capabilities to
extend Neutron logical (overlay) networks into physical (provider)
networks that are outside the OpenStack realm.
"""
required_service_extension = 'l2-gateway'
entity = 'l2_gateway'
support_status = support.SupportStatus(version='12.0.0')
PROPERTIES = (
NAME, DEVICES,
) = (
'name', 'devices',
)
_DEVICE_KEYS = (
DEVICE_NAME, INTERFACES,
) = (
'device_name', 'interfaces',
)
_INTERFACE_KEYS = (
INTERFACE_NAME, SEGMENTATION_ID,
) = (
# 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(
_("The current size of AutoscalingResourceGroup."),
support_status=support.SupportStatus(version='2015.1'),
type=attributes.Schema.INTEGER
),
REFS: attributes.Schema(
raise
self.data_delete(self.ENDPOINT)
def get_reference_id(self):
return self.data().get(self.ENDPOINT)
class SwiftSignal(resource.Resource):
"""Resource for handling signals received by SwiftSignalHandle.
This resource handles signals received by SwiftSignalHandle and
is same as WaitCondition resource.
"""
support_status = support.SupportStatus(version='2014.2')
default_client_name = "swift"
PROPERTIES = (HANDLE, TIMEOUT, COUNT,) = ('handle', 'timeout', 'count',)
properties_schema = {
HANDLE: properties.Schema(
properties.Schema.STRING,
required=True,
description=_('URL of TempURL where resource will signal '
'completion and optionally upload data.')
),
TIMEOUT: properties.Schema(
properties.Schema.NUMBER,
description=_('The maximum number of seconds to wait for the '
'resource to signal completion. Once the timeout '
'is reached, creation of the signal resource will '
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
class Bay(resource.Resource):
"""A resource that creates a Magnum Bay.
This resource has been deprecated in favor of OS::Magnum::Cluster.
"""
deprecation_msg = _('Please use OS::Magnum::Cluster instead.')
support_status = support.SupportStatus(
status=support.HIDDEN,
message=deprecation_msg,
version='11.0.0',
previous_status=support.SupportStatus(
status=support.DEPRECATED,
message=deprecation_msg,
version='9.0.0',
previous_status=support.SupportStatus(
status=support.SUPPORTED,
version='6.0.0')
)
)
PROPERTIES = (
NAME, BAYMODEL, NODE_COUNT, MASTER_COUNT, DISCOVERY_URL,
BAY_CREATE_TIMEOUT
) = (
properties_schema = {
NAME: properties.Schema(
properties.Schema.STRING,
_('Name of the metering label.')
),
DESCRIPTION: properties.Schema(
properties.Schema.STRING,
_('Description of the metering label.'),
),
SHARED: properties.Schema(
properties.Schema.BOOLEAN,
_('Whether the metering label should be shared '
'across all tenants.'),
default=False,
support_status=support.SupportStatus(version='2015.1'),
),
}
attributes_schema = {
NAME_ATTR: attributes.Schema(
_('Name of the metering label.'),
type=attributes.Schema.STRING
),
DESCRIPTION_ATTR: attributes.Schema(
_('Description of the metering label.'),
type=attributes.Schema.STRING
),
SHARED_ATTR: attributes.Schema(
_('Shared status of the metering label.'),
type=attributes.Schema.STRING
),
),
METADATA: properties.Schema(
properties.Schema.MAP,
_('Key/value pairs to associate with the volume.'),
update_allowed=True,
default={}
),
IMAGE_REF: properties.Schema(
properties.Schema.STRING,
_('The ID of the image to create the volume from.'),
support_status=support.SupportStatus(
status=support.HIDDEN,
message=_('Use property %s.') % IMAGE,
version='5.0.0',
previous_status=support.SupportStatus(
status=support.DEPRECATED,
version='2014.1'
)
)
),
IMAGE: properties.Schema(
properties.Schema.STRING,
_('If specified, the name or ID of the image to create the '
'volume from.'),
constraints=[
constraints.CustomConstraint('glance.image')
]
),
SOURCE_VOLID: properties.Schema(
properties.Schema.STRING,
_('If specified, the volume to use as source.'),
constraints=[
status=support.SUPPORTED,
version='2015.1'
)
)
),
ATTACHMENTS_LIST: attributes.Schema(
_('The list of attachments of the volume.'),
type=attributes.Schema.LIST,
cache_mode=attributes.Schema.CACHE_NONE,
support_status=support.SupportStatus(version='9.0.0'),
),
MULTI_ATTACH_ATTR: attributes.Schema(
_('Boolean indicating whether allow the volume to be attached '
'more than once.'),
type=attributes.Schema.BOOLEAN,
support_status=support.SupportStatus(version='6.0.0'),
),
}
_volume_creating_status = ['creating', 'restoring-backup', 'downloading']
entity = 'volumes'
def translation_rules(self, props):
return [
translation.TranslationRule(
props,
translation.TranslationRule.REPLACE,
[self.IMAGE],
value_path=[self.IMAGE_REF]
)
]
_('How the client will signal the wait condition. CFN_SIGNAL '
'will allow an HTTP POST to a CFN keypair signed URL. '
'TEMP_URL_SIGNAL will create a Swift TempURL to be '
'signalled via HTTP PUT. HEAT_SIGNAL will allow calls to the '
'Heat API resource-signal using the provided keystone '
'credentials. ZAQAR_SIGNAL will create a dedicated zaqar queue '
'to be signalled using the provided keystone credentials. '
'TOKEN_SIGNAL will allow and HTTP POST to a Heat API endpoint '
'with the provided keystone token. NO_SIGNAL will result in '
'the resource going to a signalled state without waiting for '
'any signal.'),
default='TOKEN_SIGNAL',
constraints=[
constraints.AllowedValues(SIGNAL_TRANSPORTS),
],
support_status=support.SupportStatus(version='6.0.0'),
),
}
ATTRIBUTES = (
TOKEN,
ENDPOINT,
CURL_CLI,
SIGNAL,
) = (
'token',
'endpoint',
'curl_cli',
'signal',
)
attributes_schema = {
'item': name,
'path': descriptive_path})
registry.pop(name, None)
return
if name in registry and isinstance(registry[name], ResourceInfo):
if registry[name] == info:
return
details = {
'path': descriptive_path,
'was': str(registry[name].value),
'now': str(info.value)}
LOG.warning('Changing %(path)s from %(was)s to %(now)s', details)
if isinstance(info, ClassResourceInfo):
if info.value.support_status.status != support.SUPPORTED:
if info.value.support_status.message is not None:
details = {
'name': info.name,
'status': str(info.value.support_status.status),
'message': str(info.value.support_status.message)
}
LOG.warning('%(name)s is %(status)s. %(message)s',
details)
info.user_resource = (self.global_registry is not None)
registry[name] = info