Merge "Make attributes definition similar on properties"
This commit is contained in:
commit
41a0108dd9
@ -46,6 +46,16 @@ class DockerContainer(resource.Resource):
|
||||
'volumes_from',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
INFO, NETWORK_INFO, NETWORK_IP, NETWORK_GATEWAY,
|
||||
NETWORK_TCP_PORTS, NETWORK_UDP_PORTS, LOGS, LOGS_HEAD,
|
||||
LOGS_TAIL,
|
||||
) = (
|
||||
'info', 'network_info', 'network_ip', 'network_gateway',
|
||||
'network_tcp_ports', 'network_udp_ports', 'logs', 'logs_head',
|
||||
'logs_tail',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
DOCKER_ENDPOINT: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -140,31 +150,31 @@ class DockerContainer(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'info': attributes.Schema(
|
||||
INFO: attributes.Schema(
|
||||
_('Container info')
|
||||
),
|
||||
'network_info': attributes.Schema(
|
||||
NETWORK_INFO: attributes.Schema(
|
||||
_('Container network info')
|
||||
),
|
||||
'network_ip': attributes.Schema(
|
||||
NETWORK_IP: attributes.Schema(
|
||||
_('Container ip address')
|
||||
),
|
||||
'network_gateway': attributes.Schema(
|
||||
NETWORK_GATEWAY: attributes.Schema(
|
||||
_('Container ip gateway')
|
||||
),
|
||||
'network_tcp_ports': attributes.Schema(
|
||||
NETWORK_TCP_PORTS: attributes.Schema(
|
||||
_('Container TCP ports')
|
||||
),
|
||||
'network_udp_ports': attributes.Schema(
|
||||
NETWORK_UDP_PORTS: attributes.Schema(
|
||||
_('Container UDP ports')
|
||||
),
|
||||
'logs': attributes.Schema(
|
||||
LOGS: attributes.Schema(
|
||||
_('Container logs')
|
||||
),
|
||||
'logs_head': attributes.Schema(
|
||||
LOGS_HEAD: attributes.Schema(
|
||||
_('Container first logs line')
|
||||
),
|
||||
'logs_tail': attributes.Schema(
|
||||
LOGS_TAIL: attributes.Schema(
|
||||
_('Container last logs line')
|
||||
),
|
||||
}
|
||||
|
@ -37,6 +37,12 @@ class MarconiQueue(resource.Resource):
|
||||
'name', 'metadata',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
QUEUE_ID, HREF,
|
||||
) = (
|
||||
'queue_id', 'href',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -50,10 +56,10 @@ class MarconiQueue(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"queue_id": attributes.Schema(
|
||||
QUEUE_ID: attributes.Schema(
|
||||
_("ID of the queue.")
|
||||
),
|
||||
"href": attributes.Schema(
|
||||
HREF: attributes.Schema(
|
||||
_("The resource href of the queue.")
|
||||
),
|
||||
}
|
||||
@ -117,7 +123,7 @@ class MarconiQueue(resource.Resource):
|
||||
return '%s/queues/%s' % (api_endpoint, queue_name)
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
if name == 'queue_id':
|
||||
if name == self.QUEUE_ID:
|
||||
return self.resource_id
|
||||
elif name == 'href':
|
||||
elif name == self.HREF:
|
||||
return self.href()
|
||||
|
@ -482,6 +482,12 @@ class WebHook(resource.Resource):
|
||||
'policy', 'name', 'metadata',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
EXECUTE_URL, CAPABILITY_URL,
|
||||
) = (
|
||||
'executeUrl', 'capabilityUrl',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
POLICY: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -505,10 +511,10 @@ class WebHook(resource.Resource):
|
||||
update_allowed_properties = (NAME, METADATA)
|
||||
|
||||
attributes_schema = {
|
||||
'executeUrl': attributes.Schema(
|
||||
EXECUTE_URL: attributes.Schema(
|
||||
_("The url for executing the webhook (requires auth).")
|
||||
),
|
||||
'capabilityUrl': attributes.Schema(
|
||||
CAPABILITY_URL: attributes.Schema(
|
||||
_("The url for executing the webhook (doesn't require auth).")
|
||||
),
|
||||
}
|
||||
|
@ -118,6 +118,12 @@ class CloudLoadBalancer(resource.Resource):
|
||||
'secureTrafficOnly',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
PUBLIC_IP,
|
||||
) = (
|
||||
'PublicIp',
|
||||
)
|
||||
|
||||
_health_monitor_schema = {
|
||||
HEALTH_MONITOR_ATTEMPTS_BEFORE_DEACTIVATION: properties.Schema(
|
||||
properties.Schema.NUMBER,
|
||||
@ -365,7 +371,7 @@ class CloudLoadBalancer(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'PublicIp': attributes.Schema(
|
||||
PUBLIC_IP: attributes.Schema(
|
||||
_('Public IP address of the specified instance.')
|
||||
),
|
||||
}
|
||||
|
@ -58,16 +58,26 @@ class CloudServer(server.Server):
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
NEW_ATTRIBUTES = (
|
||||
DISTRO, PRIVATE_IP_V4, ADMIN_PASS_ATTR,
|
||||
) = (
|
||||
'distro', 'privateIPv4', 'admin_pass',
|
||||
)
|
||||
|
||||
ATTRIBUTES = copy.deepcopy(server.Server.ATTRIBUTES)
|
||||
ATTRIBUTES += NEW_ATTRIBUTES
|
||||
|
||||
attributes_schema = copy.deepcopy(server.Server.attributes_schema)
|
||||
attributes_schema.update(
|
||||
{
|
||||
'distro': attributes.Schema(
|
||||
DISTRO: attributes.Schema(
|
||||
_('The Linux distribution on the server.')
|
||||
),
|
||||
'privateIPv4': attributes.Schema(
|
||||
PRIVATE_IP_V4: attributes.Schema(
|
||||
_('The private IPv4 address of the server.')
|
||||
),
|
||||
'admin_pass': attributes.Schema(
|
||||
ADMIN_PASS_ATTR: attributes.Schema(
|
||||
_('The administrator password for the server.')
|
||||
),
|
||||
}
|
||||
@ -203,12 +213,12 @@ class CloudServer(server.Server):
|
||||
return True
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
if name == 'distro':
|
||||
if name == self.DISTRO:
|
||||
return self.distro
|
||||
if name == 'privateIPv4':
|
||||
if name == self.PRIVATE_IP_V4:
|
||||
return nova_utils.get_ip(self.server, 'private', 4)
|
||||
if name == 'admin_pass':
|
||||
return self.data().get(self.ADMIN_PASS, '')
|
||||
if name == self.ADMIN_PASS_ATTR:
|
||||
return self.data().get(self.ADMIN_PASS_ATTR, '')
|
||||
return super(CloudServer, self)._resolve_attribute(name)
|
||||
|
||||
def handle_create(self):
|
||||
|
@ -52,6 +52,12 @@ class CloudNetwork(resource.Resource):
|
||||
"label", "cidr"
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
CIDR_ATTR, LABEL_ATTR,
|
||||
) = (
|
||||
'cidr', 'label',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
LABEL: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -70,10 +76,10 @@ class CloudNetwork(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"cidr": attributes.Schema(
|
||||
CIDR_ATTR: attributes.Schema(
|
||||
_("The CIDR for an isolated private network.")
|
||||
),
|
||||
"label": attributes.Schema(
|
||||
LABEL_ATTR: attributes.Schema(
|
||||
_("The name of the network.")
|
||||
),
|
||||
}
|
||||
|
@ -99,6 +99,12 @@ class InstanceGroup(stack_resource.StackResource):
|
||||
|
||||
_UPDATE_POLICY_SCHEMA_KEYS = (ROLLING_UPDATE,) = ('RollingUpdate',)
|
||||
|
||||
ATTRIBUTES = (
|
||||
INSTANCE_LIST,
|
||||
) = (
|
||||
'InstanceList',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
AVAILABILITY_ZONES: properties.Schema(
|
||||
properties.Schema.LIST,
|
||||
@ -141,7 +147,7 @@ class InstanceGroup(stack_resource.StackResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"InstanceList": attributes.Schema(
|
||||
INSTANCE_LIST: attributes.Schema(
|
||||
_("A comma-delimited list of server ip addresses. "
|
||||
"(Heat extension).")
|
||||
),
|
||||
@ -422,7 +428,7 @@ class InstanceGroup(stack_resource.StackResource):
|
||||
heat extension: "InstanceList" returns comma delimited list of server
|
||||
ip addresses.
|
||||
'''
|
||||
if name == 'InstanceList':
|
||||
if name == self.INSTANCE_LIST:
|
||||
return u','.join(inst.FnGetAtt('PublicIp')
|
||||
for inst in self.get_instances()) or None
|
||||
|
||||
@ -974,6 +980,12 @@ class ScalingPolicy(signal_responder.SignalResponder, CooldownMixin):
|
||||
EXACT_CAPACITY, CHANGE_IN_CAPACITY, PERCENT_CHANGE_IN_CAPACITY = (
|
||||
'ExactCapacity', 'ChangeInCapacity', 'PercentChangeInCapacity')
|
||||
|
||||
ATTRIBUTES = (
|
||||
ALARM_URL,
|
||||
) = (
|
||||
'AlarmUrl',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
AUTO_SCALING_GROUP_NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -1005,7 +1017,7 @@ class ScalingPolicy(signal_responder.SignalResponder, CooldownMixin):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"AlarmUrl": attributes.Schema(
|
||||
ALARM_URL: attributes.Schema(
|
||||
_("A signed url to handle the alarm. (Heat extension).")
|
||||
),
|
||||
}
|
||||
@ -1085,7 +1097,7 @@ class ScalingPolicy(signal_responder.SignalResponder, CooldownMixin):
|
||||
heat extension: "AlarmUrl" returns the url to post to the policy
|
||||
when there is an alarm.
|
||||
'''
|
||||
if name == 'AlarmUrl' and self.resource_id is not None:
|
||||
if name == self.ALARM_URL and self.resource_id is not None:
|
||||
return unicode(self._get_signed_url())
|
||||
|
||||
def FnGetRefId(self):
|
||||
@ -1113,6 +1125,12 @@ class AutoScalingPolicy(ScalingPolicy):
|
||||
EXACT_CAPACITY, CHANGE_IN_CAPACITY, PERCENT_CHANGE_IN_CAPACITY = (
|
||||
'exact_capacity', 'change_in_capacity', 'percent_change_in_capacity')
|
||||
|
||||
ATTRIBUTES = (
|
||||
ALARM_URL,
|
||||
) = (
|
||||
'alarm_url',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
AUTO_SCALING_GROUP_NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -1144,7 +1162,7 @@ class AutoScalingPolicy(ScalingPolicy):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"alarm_url": attributes.Schema(
|
||||
ALARM_URL: attributes.Schema(
|
||||
_("A signed url to handle the alarm.")
|
||||
),
|
||||
}
|
||||
@ -1154,7 +1172,7 @@ class AutoScalingPolicy(ScalingPolicy):
|
||||
return ''.join([t.capitalize() for t in adjustment_type.split('_')])
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
if name == 'alarm_url' and self.resource_id is not None:
|
||||
if name == self.ALARM_URL and self.resource_id is not None:
|
||||
return unicode(self._get_signed_url())
|
||||
|
||||
def FnGetRefId(self):
|
||||
|
@ -32,6 +32,12 @@ class ElasticIp(resource.Resource):
|
||||
'Domain', 'InstanceId',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
ALLOCATION_ID,
|
||||
) = (
|
||||
'AllocationId',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
DOMAIN: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -48,7 +54,7 @@ class ElasticIp(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'AllocationId': attributes.Schema(
|
||||
ALLOCATION_ID: attributes.Schema(
|
||||
_('ID that AWS assigns to represent the allocation of the address '
|
||||
'for use with Amazon VPC. Returned only for VPC elastic IP '
|
||||
'addresses.')
|
||||
@ -144,7 +150,7 @@ class ElasticIp(resource.Resource):
|
||||
return unicode(self._ipaddress())
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
if name == 'AllocationId':
|
||||
if name == self.ALLOCATION_ID:
|
||||
return unicode(self.resource_id)
|
||||
|
||||
|
||||
|
@ -43,6 +43,12 @@ class Restarter(signal_responder.SignalResponder):
|
||||
'InstanceId',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
ALARM_URL,
|
||||
) = (
|
||||
'AlarmUrl',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
INSTANCE_ID: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -52,7 +58,7 @@ class Restarter(signal_responder.SignalResponder):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"AlarmUrl": attributes.Schema(
|
||||
ALARM_URL: attributes.Schema(
|
||||
_("A signed url to handle the alarm (Heat extension).")
|
||||
),
|
||||
}
|
||||
@ -104,7 +110,7 @@ class Restarter(signal_responder.SignalResponder):
|
||||
heat extension: "AlarmUrl" returns the url to post to the policy
|
||||
when there is an alarm.
|
||||
'''
|
||||
if name == 'AlarmUrl' and self.resource_id is not None:
|
||||
if name == self.ALARM_URL and self.resource_id is not None:
|
||||
return unicode(self._get_signed_url())
|
||||
|
||||
|
||||
@ -144,6 +150,14 @@ class Instance(resource.Resource):
|
||||
'Device', 'VolumeId',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
AVAILABILITY_ZONE_ATTR, PRIVATE_DNS_NAME, PUBLIC_DNS_NAME, PRIVATE_IP,
|
||||
PUBLIC_IP,
|
||||
) = (
|
||||
'AvailabilityZone', 'PrivateDnsName', 'PublicDnsName', 'PrivateIp',
|
||||
'PublicIp',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
IMAGE_ID: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -299,20 +313,20 @@ class Instance(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'AvailabilityZone': attributes.Schema(
|
||||
AVAILABILITY_ZONE_ATTR: attributes.Schema(
|
||||
_('The Availability Zone where the specified instance is '
|
||||
'launched.')
|
||||
),
|
||||
'PrivateDnsName': attributes.Schema(
|
||||
PRIVATE_DNS_NAME: attributes.Schema(
|
||||
_('Private DNS name of the specified instance.')
|
||||
),
|
||||
'PublicDnsName': attributes.Schema(
|
||||
PUBLIC_DNS_NAME: attributes.Schema(
|
||||
_('Public DNS name of the specified instance.')
|
||||
),
|
||||
'PrivateIp': attributes.Schema(
|
||||
PRIVATE_IP: attributes.Schema(
|
||||
_('Private IP address of the specified instance.')
|
||||
),
|
||||
'PublicIp': attributes.Schema(
|
||||
PUBLIC_IP: attributes.Schema(
|
||||
_('Public IP address of the specified instance.')
|
||||
),
|
||||
}
|
||||
@ -347,10 +361,9 @@ class Instance(resource.Resource):
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
res = None
|
||||
if name == 'AvailabilityZone':
|
||||
if name == self.AVAILABILITY_ZONE_ATTR:
|
||||
res = self.properties[self.AVAILABILITY_ZONE]
|
||||
elif name in ['PublicIp', 'PrivateIp', 'PublicDnsName',
|
||||
'PrivateDnsName']:
|
||||
elif name in self.ATTRIBUTES[1:]:
|
||||
res = self._ipaddress()
|
||||
|
||||
logger.info(_('%(name)s._resolve_attribute(%(attname)s) == %(res)s'),
|
||||
|
@ -233,6 +233,14 @@ class LoadBalancer(stack_resource.StackResource):
|
||||
'SSLCertificateId', 'PolicyNames',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
CANONICAL_HOSTED_ZONE_NAME, CANONICAL_HOSTED_ZONE_NAME_ID, DNS_NAME,
|
||||
SOURCE_SECURITY_GROUP_GROUP_NAME, SOURCE_SECURITY_GROUP_OWNER_ALIAS,
|
||||
) = (
|
||||
'CanonicalHostedZoneName', 'CanonicalHostedZoneNameID', 'DNSName',
|
||||
'SourceSecurityGroup.GroupName', 'SourceSecurityGroup.OwnerAlias',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
AVAILABILITY_ZONES: properties.Schema(
|
||||
properties.Schema.LIST,
|
||||
@ -342,22 +350,22 @@ class LoadBalancer(stack_resource.StackResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"CanonicalHostedZoneName": attributes.Schema(
|
||||
CANONICAL_HOSTED_ZONE_NAME: attributes.Schema(
|
||||
_("The name of the hosted zone that is associated with the "
|
||||
"LoadBalancer.")
|
||||
),
|
||||
"CanonicalHostedZoneNameID": attributes.Schema(
|
||||
CANONICAL_HOSTED_ZONE_NAME_ID: attributes.Schema(
|
||||
_("The ID of the hosted zone name that is associated with the "
|
||||
"LoadBalancer.")
|
||||
),
|
||||
"DNSName": attributes.Schema(
|
||||
DNS_NAME: attributes.Schema(
|
||||
_("The DNS name for the LoadBalancer.")
|
||||
),
|
||||
"SourceSecurityGroup.GroupName": attributes.Schema(
|
||||
SOURCE_SECURITY_GROUP_GROUP_NAME: attributes.Schema(
|
||||
_("The security group that you can use as part of your inbound "
|
||||
"rules for your LoadBalancer's back-end instances.")
|
||||
),
|
||||
"SourceSecurityGroup.OwnerAlias": attributes.Schema(
|
||||
SOURCE_SECURITY_GROUP_OWNER_ALIAS: attributes.Schema(
|
||||
_("Owner of the source security group.")
|
||||
),
|
||||
}
|
||||
@ -516,7 +524,7 @@ class LoadBalancer(stack_resource.StackResource):
|
||||
'''
|
||||
We don't really support any of these yet.
|
||||
'''
|
||||
if name == 'DNSName':
|
||||
if name == self.DNS_NAME:
|
||||
return self.get_output('PublicIp')
|
||||
elif name in self.attributes_schema:
|
||||
# Not sure if we should return anything for the other attribs
|
||||
|
@ -34,6 +34,12 @@ class NetworkInterface(resource.Resource):
|
||||
'Key', 'Value',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
PRIVATE_IP_ADDRESS_ATTR,
|
||||
) = (
|
||||
'PrivateIpAddress',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
DESCRIPTION: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -78,7 +84,7 @@ class NetworkInterface(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'PrivateIpAddress': attributes.Schema(
|
||||
PRIVATE_IP_ADDRESS: attributes.Schema(
|
||||
_('Private IP address of the network interface.')
|
||||
),
|
||||
}
|
||||
@ -142,7 +148,7 @@ class NetworkInterface(resource.Resource):
|
||||
return self.fixed_ip_address
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
if name == 'PrivateIpAddress':
|
||||
if name == self.PRIVATE_IP_ADDRESS:
|
||||
return self._get_fixed_ip_address()
|
||||
|
||||
|
||||
|
@ -32,6 +32,14 @@ class Firewall(neutron.NeutronResource):
|
||||
'name', 'description', 'admin_state_up', 'firewall_policy_id',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
NAME_ATTR, DESCRIPTION_ATTR, ADMIN_STATE_UP_ATTR,
|
||||
FIREWALL_POLICY_ID_ATTR, STATUS, TENANT_ID, SHOW,
|
||||
) = (
|
||||
'name', 'description', 'admin_state_up',
|
||||
'firewall_policy_id', 'status', 'tenant_id', 'show',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -61,26 +69,26 @@ class Firewall(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'name': attributes.Schema(
|
||||
NAME_ATTR: attributes.Schema(
|
||||
_('Name for the firewall.')
|
||||
),
|
||||
'description': attributes.Schema(
|
||||
DESCRIPTION_ATTR: attributes.Schema(
|
||||
_('Description of the firewall.')
|
||||
),
|
||||
'admin_state_up': attributes.Schema(
|
||||
ADMIN_STATE_UP_ATTR: attributes.Schema(
|
||||
_('The administrative state of the firewall.')
|
||||
),
|
||||
'firewall_policy_id': attributes.Schema(
|
||||
FIREWALL_POLICY_ID_ATTR: attributes.Schema(
|
||||
_('Unique identifier of the firewall policy used to create '
|
||||
'the firewall.')
|
||||
),
|
||||
'status': attributes.Schema(
|
||||
STATUS: attributes.Schema(
|
||||
_('The status of the firewall.')
|
||||
),
|
||||
'tenant_id': attributes.Schema(
|
||||
TENANT_ID: attributes.Schema(
|
||||
_('Id of the tenant owning the firewall.')
|
||||
),
|
||||
'show': attributes.Schema(
|
||||
SHOW: attributes.Schema(
|
||||
_('All attributes.')
|
||||
),
|
||||
}
|
||||
@ -122,6 +130,14 @@ class FirewallPolicy(neutron.NeutronResource):
|
||||
'name', 'description', 'shared', 'audited', 'firewall_rules',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
NAME_ATTR, DESCRIPTION_ATTR, FIREWALL_RULES_ATTR, SHARED_ATTR,
|
||||
AUDITED_ATTR, TENANT_ID,
|
||||
) = (
|
||||
'name', 'description', 'firewall_rules', 'shared',
|
||||
'audited', 'tenant_id',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -158,22 +174,22 @@ class FirewallPolicy(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'name': attributes.Schema(
|
||||
NAME_ATTR: attributes.Schema(
|
||||
_('Name for the firewall policy.')
|
||||
),
|
||||
'description': attributes.Schema(
|
||||
DESCRIPTION_ATTR: attributes.Schema(
|
||||
_('Description of the firewall policy.')
|
||||
),
|
||||
'firewall_rules': attributes.Schema(
|
||||
FIREWALL_RULES_ATTR: attributes.Schema(
|
||||
_('List of firewall rules in this firewall policy.')
|
||||
),
|
||||
'shared': attributes.Schema(
|
||||
SHARED_ATTR: attributes.Schema(
|
||||
_('Shared status of this firewall policy.')
|
||||
),
|
||||
'audited': attributes.Schema(
|
||||
AUDITED_ATTR: attributes.Schema(
|
||||
_('Audit status of this firewall policy.')
|
||||
),
|
||||
'tenant_id': attributes.Schema(
|
||||
TENANT_ID: attributes.Schema(
|
||||
_('Id of the tenant owning the firewall policy.')
|
||||
),
|
||||
}
|
||||
@ -220,6 +236,18 @@ class FirewallRule(neutron.NeutronResource):
|
||||
'destination_port', 'action', 'enabled',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
NAME_ATTR, DESCRIPTION_ATTR, FIREWALL_POLICY_ID, SHARED_ATTR,
|
||||
PROTOCOL_ATTR, IP_VERSION_ATTR, SOURCE_IP_ADDRESS_ATTR,
|
||||
DESTINATION_IP_ADDRESS_ATTR, SOURCE_PORT_ATTR, DESTINATION_PORT_ATTR,
|
||||
ACTION_ATTR, ENABLED_ATTR, POSITION, TENANT_ID,
|
||||
) = (
|
||||
'name', 'description', 'firewall_policy_id', 'shared',
|
||||
'protocol', 'ip_version', 'source_ip_address',
|
||||
'destination_ip_address', 'source_port', 'destination_port',
|
||||
'action', 'enabled', 'position', 'tenant_id',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -292,47 +320,47 @@ class FirewallRule(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'name': attributes.Schema(
|
||||
NAME_ATTR: attributes.Schema(
|
||||
_('Name for the firewall rule.')
|
||||
),
|
||||
'description': attributes.Schema(
|
||||
DESCRIPTION_ATTR: attributes.Schema(
|
||||
_('Description of the firewall rule.')
|
||||
),
|
||||
'firewall_policy_id': attributes.Schema(
|
||||
FIREWALL_POLICY_ID: attributes.Schema(
|
||||
_('Unique identifier of the firewall policy to which this '
|
||||
'firewall rule belongs.')
|
||||
),
|
||||
'shared': attributes.Schema(
|
||||
SHARED_ATTR: attributes.Schema(
|
||||
_('Shared status of this firewall rule.')
|
||||
),
|
||||
'protocol': attributes.Schema(
|
||||
PROTOCOL_ATTR: attributes.Schema(
|
||||
_('Protocol value for this firewall rule.')
|
||||
),
|
||||
'ip_version': attributes.Schema(
|
||||
IP_VERSION_ATTR: attributes.Schema(
|
||||
_('Ip_version for this firewall rule.')
|
||||
),
|
||||
'source_ip_address': attributes.Schema(
|
||||
SOURCE_IP_ADDRESS_ATTR: attributes.Schema(
|
||||
_('Source ip_address for this firewall rule.')
|
||||
),
|
||||
'destination_ip_address': attributes.Schema(
|
||||
DESTINATION_IP_ADDRESS_ATTR: attributes.Schema(
|
||||
_('Destination ip_address for this firewall rule.')
|
||||
),
|
||||
'source_port': attributes.Schema(
|
||||
SOURCE_PORT_ATTR: attributes.Schema(
|
||||
_('Source port range for this firewall rule.')
|
||||
),
|
||||
'destination_port': attributes.Schema(
|
||||
DESTINATION_PORT_ATTR: attributes.Schema(
|
||||
_('Destination port range for this firewall rule.')
|
||||
),
|
||||
'action': attributes.Schema(
|
||||
ACTION_ATTR: attributes.Schema(
|
||||
_('Allow or deny action for this firewall rule.')
|
||||
),
|
||||
'enabled': attributes.Schema(
|
||||
ENABLED_ATTR: attributes.Schema(
|
||||
_('Indicates whether this firewall rule is enabled or not.')
|
||||
),
|
||||
'position': attributes.Schema(
|
||||
POSITION: attributes.Schema(
|
||||
_('Position of the rule within the firewall policy.')
|
||||
),
|
||||
'tenant_id': attributes.Schema(
|
||||
TENANT_ID: attributes.Schema(
|
||||
_('Id of the tenant owning the firewall.')
|
||||
),
|
||||
}
|
||||
|
@ -31,6 +31,14 @@ class FloatingIP(neutron.NeutronResource):
|
||||
'value_specs', 'port_id', 'fixed_ip_address',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
ROUTER_ID, TENANT_ID, FLOATING_NETWORK_ID_ATTR, FIXED_IP_ADDRESS_ATTR,
|
||||
FLOATING_IP_ADDRESS_ATTR, PORT_ID_ATTR, SHOW,
|
||||
) = (
|
||||
'router_id', 'tenant_id', 'floating_network_id', 'fixed_ip_address',
|
||||
'floating_ip_address', 'port_id', 'show',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
FLOATING_NETWORK_ID: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -63,26 +71,26 @@ class FloatingIP(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'router_id': attributes.Schema(
|
||||
ROUTER_ID: attributes.Schema(
|
||||
_('ID of the router used as gateway, set when associated with a '
|
||||
'port.')
|
||||
),
|
||||
'tenant_id': attributes.Schema(
|
||||
TENANT_ID: attributes.Schema(
|
||||
_('The tenant owning this floating IP.')
|
||||
),
|
||||
'floating_network_id': attributes.Schema(
|
||||
FLOATING_NETWORK_ID_ATTR: attributes.Schema(
|
||||
_('ID of the network in which this IP is allocated.')
|
||||
),
|
||||
'fixed_ip_address': attributes.Schema(
|
||||
FIXED_IP_ADDRESS_ATTR: attributes.Schema(
|
||||
_('IP address of the associated port, if specified.')
|
||||
),
|
||||
'floating_ip_address': attributes.Schema(
|
||||
FLOATING_IP_ADDRESS_ATTR: attributes.Schema(
|
||||
_('The allocated address of this IP.')
|
||||
),
|
||||
'port_id': attributes.Schema(
|
||||
PORT_ID_ATTR: attributes.Schema(
|
||||
_('ID of the port associated with this IP.')
|
||||
),
|
||||
'show': attributes.Schema(
|
||||
SHOW: attributes.Schema(
|
||||
_('All attributes.')
|
||||
),
|
||||
}
|
||||
|
@ -39,6 +39,16 @@ class HealthMonitor(neutron.NeutronResource):
|
||||
'http_method', 'expected_codes', 'url_path',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
ADMIN_STATE_UP_ATTR, DELAY_ATTR, EXPECTED_CODES_ATTR, HTTP_METHOD_ATTR,
|
||||
MAX_RETRIES_ATTR, TIMEOUT_ATTR, TYPE_ATTR, URL_PATH_ATTR, TENANT_ID,
|
||||
SHOW,
|
||||
) = (
|
||||
'admin_state_up', 'delay', 'expected_codes', 'http_method',
|
||||
'max_retries', 'timeout', 'type', 'url_path', 'tenant_id',
|
||||
'show',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
DELAY: properties.Schema(
|
||||
properties.Schema.INTEGER,
|
||||
@ -96,39 +106,39 @@ class HealthMonitor(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'admin_state_up': attributes.Schema(
|
||||
ADMIN_STATE_UP_ATTR: attributes.Schema(
|
||||
_('The administrative state of this health monitor.')
|
||||
),
|
||||
'delay': attributes.Schema(
|
||||
DELAY_ATTR: attributes.Schema(
|
||||
_('The minimum time in seconds between regular connections '
|
||||
'of the member.')
|
||||
),
|
||||
'expected_codes': attributes.Schema(
|
||||
EXPECTED_CODES_ATTR: attributes.Schema(
|
||||
_('The list of HTTP status codes expected in response '
|
||||
'from the member to declare it healthy.')
|
||||
),
|
||||
'http_method': attributes.Schema(
|
||||
HTTP_METHOD_ATTR: attributes.Schema(
|
||||
_('The HTTP method used for requests by the monitor of type HTTP.')
|
||||
),
|
||||
'max_retries': attributes.Schema(
|
||||
MAX_RETRIES_ATTR: attributes.Schema(
|
||||
_('Number of permissible connection failures before changing '
|
||||
'the member status to INACTIVE.')
|
||||
),
|
||||
'timeout': attributes.Schema(
|
||||
TIMEOUT_ATTR: attributes.Schema(
|
||||
_('Maximum number of seconds for a monitor to wait for a '
|
||||
'connection to be established before it times out.')
|
||||
),
|
||||
'type': attributes.Schema(
|
||||
TYPE_ATTR: attributes.Schema(
|
||||
_('One of predefined health monitor types.')
|
||||
),
|
||||
'url_path': attributes.Schema(
|
||||
URL_PATH_ATTR: attributes.Schema(
|
||||
_('The HTTP path used in the HTTP request used by the monitor '
|
||||
'to test a member health.')
|
||||
),
|
||||
'tenant_id': attributes.Schema(
|
||||
TENANT_ID: attributes.Schema(
|
||||
_('Tenant owning the health monitor.')
|
||||
),
|
||||
'show': attributes.Schema(
|
||||
SHOW: attributes.Schema(
|
||||
_('All attributes.')
|
||||
),
|
||||
}
|
||||
@ -188,6 +198,14 @@ class Pool(neutron.NeutronResource):
|
||||
'type', 'cookie_name',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
ADMIN_STATE_UP_ATTR, NAME_ATTR, PROTOCOL_ATTR, SUBNET_ID_ATTR,
|
||||
LB_METHOD_ATTR, DESCRIPTION_ATTR, TENANT_ID, VIP_ATTR,
|
||||
) = (
|
||||
'admin_state_up', 'name', 'protocol', 'subnet_id',
|
||||
'lb_method', 'description', 'tenant_id', 'vip',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
PROTOCOL: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -304,30 +322,30 @@ class Pool(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'admin_state_up': attributes.Schema(
|
||||
ADMIN_STATE_UP_ATTR: attributes.Schema(
|
||||
_('The administrative state of this pool.')
|
||||
),
|
||||
'name': attributes.Schema(
|
||||
NAME_ATTR: attributes.Schema(
|
||||
_('Name of the pool.')
|
||||
),
|
||||
'protocol': attributes.Schema(
|
||||
PROTOCOL_ATTR: attributes.Schema(
|
||||
_('Protocol to balance.')
|
||||
),
|
||||
'subnet_id': attributes.Schema(
|
||||
SUBNET_ID_ATTR: attributes.Schema(
|
||||
_('The subnet for the port on which the members of the pool '
|
||||
'will be connected.')
|
||||
),
|
||||
'lb_method': attributes.Schema(
|
||||
LB_METHOD_ATTR: attributes.Schema(
|
||||
_('The algorithm used to distribute load between the members '
|
||||
'of the pool.')
|
||||
),
|
||||
'description': attributes.Schema(
|
||||
DESCRIPTION_ATTR: attributes.Schema(
|
||||
_('Description of the pool.')
|
||||
),
|
||||
'tenant_id': attributes.Schema(
|
||||
TENANT_ID: attributes.Schema(
|
||||
_('Tenant owning the pool.')
|
||||
),
|
||||
'vip': attributes.Schema(
|
||||
VIP_ATTR: attributes.Schema(
|
||||
_('Vip associated with the pool.')
|
||||
),
|
||||
}
|
||||
@ -433,7 +451,7 @@ class Pool(neutron.NeutronResource):
|
||||
client.update_pool(self.resource_id, {'pool': prop_diff})
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
if name == 'vip':
|
||||
if name == self.VIP_ATTR:
|
||||
return self.neutron().show_vip(self.metadata_get()['vip'])['vip']
|
||||
return super(Pool, self)._resolve_attribute(name)
|
||||
|
||||
@ -485,6 +503,14 @@ class PoolMember(neutron.NeutronResource):
|
||||
'pool_id', 'address', 'protocol_port', 'weight', 'admin_state_up',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
ADMIN_STATE_UP_ATTR, TENANT_ID, WEIGHT_ATTR, ADDRESS_ATTR,
|
||||
POOL_ID_ATTR, PROTOCOL_PORT_ATTR, SHOW,
|
||||
) = (
|
||||
'admin_state_up', 'tenant_id', 'weight', 'address',
|
||||
'pool_id', 'protocol_port', 'show',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
POOL_ID: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -522,26 +548,26 @@ class PoolMember(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'admin_state_up': attributes.Schema(
|
||||
ADMIN_STATE_UP_ATTR: attributes.Schema(
|
||||
_('The administrative state of this pool member.')
|
||||
),
|
||||
'tenant_id': attributes.Schema(
|
||||
TENANT_ID: attributes.Schema(
|
||||
_('Tenant owning the pool member.')
|
||||
),
|
||||
'weight': attributes.Schema(
|
||||
WEIGHT_ATTR: attributes.Schema(
|
||||
_('Weight of the pool member in the pool.')
|
||||
),
|
||||
'address': attributes.Schema(
|
||||
ADDRESS_ATTR: attributes.Schema(
|
||||
_('IP address of the pool member.')
|
||||
),
|
||||
'pool_id': attributes.Schema(
|
||||
POOL_ID_ATTR: attributes.Schema(
|
||||
_('The ID of the load balancing pool.')
|
||||
),
|
||||
'protocol_port': attributes.Schema(
|
||||
PROTOCOL_PORT_ATTR: attributes.Schema(
|
||||
_('TCP port on which the pool member listens for requests or '
|
||||
'connections.')
|
||||
),
|
||||
'show': attributes.Schema(
|
||||
SHOW: attributes.Schema(
|
||||
_('All attributes.')
|
||||
),
|
||||
}
|
||||
|
@ -32,6 +32,12 @@ class MeteringLabel(neutron.NeutronResource):
|
||||
'name', 'description',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
NAME_ATTR, DESCRIPTION_ATTR,
|
||||
) = (
|
||||
'name', 'description',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -44,10 +50,10 @@ class MeteringLabel(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'name': attributes.Schema(
|
||||
NAME_ATTR: attributes.Schema(
|
||||
_('Name of the metering label.')
|
||||
),
|
||||
'description': attributes.Schema(
|
||||
DESCRIPTION_ATTR: attributes.Schema(
|
||||
_('Description of the metering label.')
|
||||
),
|
||||
}
|
||||
@ -86,6 +92,14 @@ class MeteringRule(neutron.NeutronResource):
|
||||
'metering_label_id', 'remote_ip_prefix', 'direction', 'excluded',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
DIRECTION_ATTR, EXCLUDED_ATTR, METERING_LABEL_ID_ATTR,
|
||||
REMOTE_IP_PREFIX_ATTR,
|
||||
) = (
|
||||
'direction', 'excluded', 'metering_label_id',
|
||||
'remote_ip_prefix',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
METERING_LABEL_ID: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -116,16 +130,16 @@ class MeteringRule(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'direction': attributes.Schema(
|
||||
DIRECTION_ATTR: attributes.Schema(
|
||||
_('The direction in which metering rule is applied.')
|
||||
),
|
||||
'excluded': attributes.Schema(
|
||||
EXCLUDED_ATTR: attributes.Schema(
|
||||
_('Exclude state for cidr.')
|
||||
),
|
||||
'metering_label_id': attributes.Schema(
|
||||
METERING_LABEL_ID_ATTR: attributes.Schema(
|
||||
_('The metering label ID to associate with this metering rule.')
|
||||
),
|
||||
'remote_ip_prefix': attributes.Schema(
|
||||
REMOTE_IP_PREFIX_ATTR: attributes.Schema(
|
||||
_('CIDR to be associated with this metering rule.')
|
||||
),
|
||||
}
|
||||
|
@ -31,6 +31,12 @@ class Net(neutron.NeutronResource):
|
||||
'dhcp_agent_ids',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
STATUS, NAME_ATTR, SUBNETS, ADMIN_STATE_UP_ATTR, TENANT_ID_ATTR, SHOW,
|
||||
) = (
|
||||
"status", "name", "subnets", "admin_state_up", "tenant_id", "show",
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -77,22 +83,22 @@ class Net(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"status": attributes.Schema(
|
||||
STATUS: attributes.Schema(
|
||||
_("The status of the network.")
|
||||
),
|
||||
"name": attributes.Schema(
|
||||
NAME_ATTR: attributes.Schema(
|
||||
_("The name of the network.")
|
||||
),
|
||||
"subnets": attributes.Schema(
|
||||
SUBNETS: attributes.Schema(
|
||||
_("Subnets of this network.")
|
||||
),
|
||||
"admin_state_up": attributes.Schema(
|
||||
ADMIN_STATE_UP_ATTR: attributes.Schema(
|
||||
_("The administrative status of the network.")
|
||||
),
|
||||
"tenant_id": attributes.Schema(
|
||||
TENANT_ID_ATTR: attributes.Schema(
|
||||
_("The tenant owning this network.")
|
||||
),
|
||||
"show": attributes.Schema(
|
||||
SHOW: attributes.Schema(
|
||||
_("All attributes.")
|
||||
),
|
||||
}
|
||||
|
@ -37,6 +37,12 @@ class NetworkGateway(neutron.NeutronResource):
|
||||
'name', 'devices', 'connections',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
DEFAULT, SHOW,
|
||||
) = (
|
||||
'default', 'show',
|
||||
)
|
||||
|
||||
_DEVICES_KEYS = (
|
||||
ID, INTERFACE_NAME,
|
||||
) = (
|
||||
@ -124,10 +130,10 @@ class NetworkGateway(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"default": attributes.Schema(
|
||||
DEFAULT: attributes.Schema(
|
||||
_("A boolean value of default flag.")
|
||||
),
|
||||
"show": attributes.Schema(
|
||||
SHOW: attributes.Schema(
|
||||
_("All attributes.")
|
||||
),
|
||||
}
|
||||
|
@ -51,6 +51,16 @@ class Port(neutron.NeutronResource):
|
||||
'mac_address', 'ip_address',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
ADMIN_STATE_UP_ATTR, DEVICE_ID_ATTR, DEVICE_OWNER_ATTR, FIXED_IPS_ATTR,
|
||||
MAC_ADDRESS_ATTR, NAME_ATTR, NETWORK_ID_ATTR, SECURITY_GROUPS_ATTR,
|
||||
STATUS, TENANT_ID, ALLOWED_ADDRESS_PAIRS_ATTR, SHOW,
|
||||
) = (
|
||||
'admin_state_up', 'device_id', 'device_owner', 'fixed_ips',
|
||||
'mac_address', 'name', 'network_id', 'security_groups',
|
||||
'status', 'tenant_id', 'allowed_address_pairs', 'show',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NETWORK_ID: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -151,41 +161,41 @@ class Port(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"admin_state_up": attributes.Schema(
|
||||
ADMIN_STATE_UP_ATTR: attributes.Schema(
|
||||
_("The administrative state of this port.")
|
||||
),
|
||||
"device_id": attributes.Schema(
|
||||
DEVICE_ID_ATTR: attributes.Schema(
|
||||
_("Unique identifier for the device.")
|
||||
),
|
||||
"device_owner": attributes.Schema(
|
||||
DEVICE_OWNER: attributes.Schema(
|
||||
_("Name of the network owning the port.")
|
||||
),
|
||||
"fixed_ips": attributes.Schema(
|
||||
FIXED_IPS_ATTR: attributes.Schema(
|
||||
_("Fixed IP addresses.")
|
||||
),
|
||||
"mac_address": attributes.Schema(
|
||||
MAC_ADDRESS_ATTR: attributes.Schema(
|
||||
_("MAC address of the port.")
|
||||
),
|
||||
"name": attributes.Schema(
|
||||
NAME_ATTR: attributes.Schema(
|
||||
_("Friendly name of the port.")
|
||||
),
|
||||
"network_id": attributes.Schema(
|
||||
NETWORK_ID_ATTR: attributes.Schema(
|
||||
_("Unique identifier for the network owning the port.")
|
||||
),
|
||||
"security_groups": attributes.Schema(
|
||||
SECURITY_GROUPS_ATTR: attributes.Schema(
|
||||
_("A list of security groups for the port.")
|
||||
),
|
||||
"status": attributes.Schema(
|
||||
STATUS: attributes.Schema(
|
||||
_("The status of the port.")
|
||||
),
|
||||
"tenant_id": attributes.Schema(
|
||||
TENANT_ID: attributes.Schema(
|
||||
_("Tenant owning the port.")
|
||||
),
|
||||
"allowed_address_pairs": attributes.Schema(
|
||||
ALLOWED_ADDRESS_PAIRS_ATTR: attributes.Schema(
|
||||
_("Additional MAC/IP address pairs allowed to pass through "
|
||||
"a port.")
|
||||
),
|
||||
"show": attributes.Schema(
|
||||
SHOW: attributes.Schema(
|
||||
_("All attributes.")
|
||||
),
|
||||
}
|
||||
|
@ -27,6 +27,13 @@ class ProviderNet(net.Net):
|
||||
'name', 'network_type', 'physical_network',
|
||||
'segmentation_id', 'admin_state_up', 'shared',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
STATUS, SUBNETS, SHOW,
|
||||
) = (
|
||||
'status', 'subnets', 'show',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: net.Net.properties_schema[NAME],
|
||||
PROVIDER_NETWORK_TYPE: properties.Schema(
|
||||
@ -62,13 +69,13 @@ class ProviderNet(net.Net):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"status": attributes.Schema(
|
||||
STATUS: attributes.Schema(
|
||||
_("The status of the network.")
|
||||
),
|
||||
"subnets": attributes.Schema(
|
||||
SUBNETS: attributes.Schema(
|
||||
_("Subnets of this network.")
|
||||
),
|
||||
"show": attributes.Schema(
|
||||
SHOW: attributes.Schema(
|
||||
_("All attributes.")
|
||||
),
|
||||
}
|
||||
|
@ -39,6 +39,14 @@ class Router(neutron.NeutronResource):
|
||||
'network', 'enable_snat',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
STATUS, EXTERNAL_GATEWAY_INFO_ATTR, NAME_ATTR, ADMIN_STATE_UP_ATTR,
|
||||
TENANT_ID, SHOW,
|
||||
) = (
|
||||
'status', 'external_gateway_info', 'name', 'admin_state_up',
|
||||
'tenant_id', 'show',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -87,22 +95,22 @@ class Router(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"status": attributes.Schema(
|
||||
STATUS: attributes.Schema(
|
||||
_("The status of the router.")
|
||||
),
|
||||
"external_gateway_info": attributes.Schema(
|
||||
EXTERNAL_GATEWAY_INFO_ATTR: attributes.Schema(
|
||||
_("Gateway network for the router.")
|
||||
),
|
||||
"name": attributes.Schema(
|
||||
NAME_ATTR: attributes.Schema(
|
||||
_("Friendly name of the router.")
|
||||
),
|
||||
"admin_state_up": attributes.Schema(
|
||||
ADMIN_STATE_UP_ATTR: attributes.Schema(
|
||||
_("Administrative state of the router.")
|
||||
),
|
||||
"tenant_id": attributes.Schema(
|
||||
TENANT_ID: attributes.Schema(
|
||||
_("Tenant owning the router.")
|
||||
),
|
||||
"show": attributes.Schema(
|
||||
SHOW: attributes.Schema(
|
||||
_("All attributes.")
|
||||
),
|
||||
}
|
||||
|
@ -46,6 +46,16 @@ class Subnet(neutron.NeutronResource):
|
||||
'destination', 'nexthop',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
NAME_ATTR, NETWORK_ID_ATTR, TENANT_ID_ATTR, ALLOCATION_POOLS_ATTR,
|
||||
GATEWAY_IP_ATTR, HOST_ROUTES_ATTR, IP_VERSION_ATTR, CIDR_ATTR,
|
||||
DNS_NAMESERVERS_ATTR, ENABLE_DHCP_ATTR, SHOW,
|
||||
) = (
|
||||
'name', 'network_id', 'tenant_id', 'allocation_pools',
|
||||
'gateway_ip', 'host_routes', 'ip_version', 'cidr',
|
||||
'dns_nameservers', 'enable_dhcp', 'show',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NETWORK_ID: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -141,37 +151,37 @@ class Subnet(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"name": attributes.Schema(
|
||||
NAME_ATTR: attributes.Schema(
|
||||
_("Friendly name of the subnet.")
|
||||
),
|
||||
"network_id": attributes.Schema(
|
||||
NETWORK_ID_ATTR: attributes.Schema(
|
||||
_("Parent network of the subnet.")
|
||||
),
|
||||
"tenant_id": attributes.Schema(
|
||||
TENANT_ID_ATTR: attributes.Schema(
|
||||
_("Tenant owning the subnet.")
|
||||
),
|
||||
"allocation_pools": attributes.Schema(
|
||||
ALLOCATION_POOLS_ATTR: attributes.Schema(
|
||||
_("Ip allocation pools and their ranges.")
|
||||
),
|
||||
"gateway_ip": attributes.Schema(
|
||||
GATEWAY_IP_ATTR: attributes.Schema(
|
||||
_("Ip of the subnet's gateway.")
|
||||
),
|
||||
"host_routes": attributes.Schema(
|
||||
HOST_ROUTES_ATTR: attributes.Schema(
|
||||
_("Additional routes for this subnet.")
|
||||
),
|
||||
"ip_version": attributes.Schema(
|
||||
IP_VERSION_ATTR: attributes.Schema(
|
||||
_("Ip version for the subnet.")
|
||||
),
|
||||
"cidr": attributes.Schema(
|
||||
CIDR_ATTR: attributes.Schema(
|
||||
_("CIDR block notation for this subnet.")
|
||||
),
|
||||
"dns_nameservers": attributes.Schema(
|
||||
DNS_NAMESERVERS_ATTR: attributes.Schema(
|
||||
_("List of dns nameservers.")
|
||||
),
|
||||
"enable_dhcp": attributes.Schema(
|
||||
ENABLE_DHCP_ATTR: attributes.Schema(
|
||||
_("'true' if DHCP is enabled for this subnet; 'false' otherwise.")
|
||||
),
|
||||
"show": attributes.Schema(
|
||||
SHOW: attributes.Schema(
|
||||
_("All attributes.")
|
||||
),
|
||||
}
|
||||
|
@ -35,6 +35,14 @@ class VPNService(neutron.NeutronResource):
|
||||
'subnet_id', 'subnet', 'router_id',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
ADMIN_STATE_UP_ATTR, DESCRIPTION_ATTR, NAME_ATTR, ROUTER_ID_ATTR,
|
||||
STATUS, SUBNET_ID_ATTR, TENANT_ID, SHOW,
|
||||
) = (
|
||||
'admin_state_up', 'description', 'name', 'router_id',
|
||||
'status', 'subnet_id', 'tenant_id', 'show',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -73,30 +81,30 @@ class VPNService(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'admin_state_up': attributes.Schema(
|
||||
ADMIN_STATE_UP_ATTR: attributes.Schema(
|
||||
_('The administrative state of the vpn service.')
|
||||
),
|
||||
'description': attributes.Schema(
|
||||
DESCRIPTION_ATTR: attributes.Schema(
|
||||
_('The description of the vpn service.')
|
||||
),
|
||||
'name': attributes.Schema(
|
||||
NAME_ATTR: attributes.Schema(
|
||||
_('The name of the vpn service.')
|
||||
),
|
||||
'router_id': attributes.Schema(
|
||||
ROUTER_ID_ATTR: attributes.Schema(
|
||||
_('The unique identifier of the router to which the vpn service '
|
||||
'was inserted.')
|
||||
),
|
||||
'status': attributes.Schema(
|
||||
STATUS: attributes.Schema(
|
||||
_('The status of the vpn service.')
|
||||
),
|
||||
'subnet_id': attributes.Schema(
|
||||
SUBNET_ID_ATTR: attributes.Schema(
|
||||
_('The unique identifier of the subnet in which the vpn service '
|
||||
'was created.')
|
||||
),
|
||||
'tenant_id': attributes.Schema(
|
||||
TENANT_ID: attributes.Schema(
|
||||
_('The unique identifier of the tenant owning the vpn service.')
|
||||
),
|
||||
'show': attributes.Schema(
|
||||
SHOW: attributes.Schema(
|
||||
_('All attributes.')
|
||||
),
|
||||
}
|
||||
@ -156,6 +164,18 @@ class IPsecSiteConnection(neutron.NeutronResource):
|
||||
'actions', 'interval', 'timeout',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
ADMIN_STATE_UP_ATTR, AUTH_MODE, DESCRIPTION_ATTR, DPD_ATTR,
|
||||
IKEPOLICY_ID_ATTR, INITIATOR_ATTR, IPSECPOLICY_ID_ATTR, MTU_ATTR,
|
||||
NAME_ATTR, PEER_ADDRESS_ATTR, PEER_CIDRS_ATTR, PEER_ID_ATTR, PSK_ATTR,
|
||||
ROUTE_MODE, STATUS, TENANT_ID, VPNSERVICE_ID_ATTR,
|
||||
) = (
|
||||
'admin_state_up', 'auth_mode', 'description', 'dpd',
|
||||
'ikepolicy_id', 'initiator', 'ipsecpolicy_id', 'mtu',
|
||||
'name', 'peer_address', 'peer_cidrs', 'peer_id', 'psk',
|
||||
'route_mode', 'status', 'tenant_id', 'vpnservice_id',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -256,63 +276,63 @@ class IPsecSiteConnection(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'admin_state_up': attributes.Schema(
|
||||
ADMIN_STATE_UP_ATTR: attributes.Schema(
|
||||
_('The administrative state of the ipsec site connection.')
|
||||
),
|
||||
'auth_mode': attributes.Schema(
|
||||
AUTH_MODE: attributes.Schema(
|
||||
_('The authentication mode of the ipsec site connection.')
|
||||
),
|
||||
'description': attributes.Schema(
|
||||
DESCRIPTION_ATTR: attributes.Schema(
|
||||
_('The description of the ipsec site connection.')
|
||||
),
|
||||
'dpd': attributes.Schema(
|
||||
DPD_ATTR: attributes.Schema(
|
||||
_('The dead peer detection protocol configuration of the ipsec '
|
||||
'site connection.')
|
||||
),
|
||||
'ikepolicy_id': attributes.Schema(
|
||||
IKEPOLICY_ID_ATTR: attributes.Schema(
|
||||
_('The unique identifier of ike policy associated with the ipsec '
|
||||
'site connection.')
|
||||
),
|
||||
'initiator': attributes.Schema(
|
||||
INITIATOR_ATTR: attributes.Schema(
|
||||
_('The initiator of the ipsec site connection.')
|
||||
),
|
||||
'ipsecpolicy_id': attributes.Schema(
|
||||
IPSECPOLICY_ID_ATTR: attributes.Schema(
|
||||
_('The unique identifier of ipsec policy associated with the '
|
||||
'ipsec site connection.')
|
||||
),
|
||||
'mtu': attributes.Schema(
|
||||
MTU_ATTR: attributes.Schema(
|
||||
_('The maximum transmission unit size (in bytes) of the ipsec '
|
||||
'site connection.')
|
||||
),
|
||||
'name': attributes.Schema(
|
||||
NAME_ATTR: attributes.Schema(
|
||||
_('The name of the ipsec site connection.')
|
||||
),
|
||||
'peer_address': attributes.Schema(
|
||||
PEER_ADDRESS_ATTR: attributes.Schema(
|
||||
_('The remote branch router public IPv4 address or IPv6 address '
|
||||
'or FQDN.')
|
||||
),
|
||||
'peer_cidrs': attributes.Schema(
|
||||
PEER_CIDRS_ATTR: attributes.Schema(
|
||||
_('The remote subnet(s) in CIDR format of the ipsec site '
|
||||
'connection.')
|
||||
),
|
||||
'peer_id': attributes.Schema(
|
||||
PEER_ID_ATTR: attributes.Schema(
|
||||
_('The remote branch router identity of the ipsec site '
|
||||
'connection.')
|
||||
),
|
||||
'psk': attributes.Schema(
|
||||
PSK_ATTR: attributes.Schema(
|
||||
_('The pre-shared key string of the ipsec site connection.')
|
||||
),
|
||||
'route_mode': attributes.Schema(
|
||||
ROUTE_MODE: attributes.Schema(
|
||||
_('The route mode of the ipsec site connection.')
|
||||
),
|
||||
'status': attributes.Schema(
|
||||
STATUS: attributes.Schema(
|
||||
_('The status of the ipsec site connection.')
|
||||
),
|
||||
'tenant_id': attributes.Schema(
|
||||
TENANT_ID: attributes.Schema(
|
||||
_('The unique identifier of the tenant owning the ipsec site '
|
||||
'connection.')
|
||||
),
|
||||
'vpnservice_id': attributes.Schema(
|
||||
VPNSERVICE_ID_ATTR: attributes.Schema(
|
||||
_('The unique identifier of vpn service associated with the ipsec '
|
||||
'site connection.')
|
||||
),
|
||||
@ -364,6 +384,16 @@ class IKEPolicy(neutron.NeutronResource):
|
||||
'units', 'value',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
AUTH_ALGORITHM_ATTR, DESCRIPTION_ATTR, ENCRYPTION_ALGORITHM_ATTR,
|
||||
IKE_VERSION_ATTR, LIFETIME_ATTR, NAME_ATTR, PFS_ATTR,
|
||||
PHASE1_NEGOTIATION_MODE_ATTR, TENANT_ID,
|
||||
) = (
|
||||
'auth_algorithm', 'description', 'encryption_algorithm',
|
||||
'ike_version', 'lifetime', 'name', 'pfs',
|
||||
'phase1_negotiation_mode', 'tenant_id',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -439,32 +469,32 @@ class IKEPolicy(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'auth_algorithm': attributes.Schema(
|
||||
AUTH_ALGORITHM_ATTR: attributes.Schema(
|
||||
_('The authentication hash algorithm used by the ike policy.')
|
||||
),
|
||||
'description': attributes.Schema(
|
||||
DESCRIPTION_ATTR: attributes.Schema(
|
||||
_('The description of the ike policy.')
|
||||
),
|
||||
'encryption_algorithm': attributes.Schema(
|
||||
ENCRYPTION_ALGORITHM_ATTR: attributes.Schema(
|
||||
_('The encryption algorithm used by the ike policy.')
|
||||
),
|
||||
'ike_version': attributes.Schema(
|
||||
IKE_VERSION_ATTR: attributes.Schema(
|
||||
_('The version of the ike policy.')
|
||||
),
|
||||
'lifetime': attributes.Schema(
|
||||
LIFETIME_ATTR: attributes.Schema(
|
||||
_('The safety assessment lifetime configuration for the ike '
|
||||
'policy.')
|
||||
),
|
||||
'name': attributes.Schema(
|
||||
NAME_ATTR: attributes.Schema(
|
||||
_('The name of the ike policy.')
|
||||
),
|
||||
'pfs': attributes.Schema(
|
||||
PFS_ATTR: attributes.Schema(
|
||||
_('The perfect forward secrecy of the ike policy.')
|
||||
),
|
||||
'phase1_negotiation_mode': attributes.Schema(
|
||||
PHASE1_NEGOTIATION_MODE_ATTR: attributes.Schema(
|
||||
_('The negotiation mode of the ike policy.')
|
||||
),
|
||||
'tenant_id': attributes.Schema(
|
||||
TENANT_ID: attributes.Schema(
|
||||
_('The unique identifier of the tenant owning the ike policy.')
|
||||
),
|
||||
}
|
||||
@ -514,6 +544,16 @@ class IPsecPolicy(neutron.NeutronResource):
|
||||
'units', 'value',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
AUTH_ALGORITHM_ATTR, DESCRIPTION_ATTR, ENCAPSULATION_MODE_ATTR,
|
||||
ENCRYPTION_ALGORITHM_ATTR, LIFETIME_ATTR, NAME_ATTR, PFS_ATTR,
|
||||
TENANT_ID, TRANSFORM_PROTOCOL_ATTR,
|
||||
) = (
|
||||
'auth_algorithm', 'description', 'encapsulation_mode',
|
||||
'encryption_algorithm', 'lifetime', 'name', 'pfs',
|
||||
'tenant_id', 'transform_protocol',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -591,32 +631,32 @@ class IPsecPolicy(neutron.NeutronResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'auth_algorithm': attributes.Schema(
|
||||
AUTH_ALGORITHM_ATTR: attributes.Schema(
|
||||
_('The authentication hash algorithm of the ipsec policy.')
|
||||
),
|
||||
'description': attributes.Schema(
|
||||
DESCRIPTION_ATTR: attributes.Schema(
|
||||
_('The description of the ipsec policy.')
|
||||
),
|
||||
'encapsulation_mode': attributes.Schema(
|
||||
ENCAPSULATION_MODE_ATTR: attributes.Schema(
|
||||
_('The encapsulation mode of the ipsec policy.')
|
||||
),
|
||||
'encryption_algorithm': attributes.Schema(
|
||||
ENCRYPTION_ALGORITHM_ATTR: attributes.Schema(
|
||||
_('The encryption algorithm of the ipsec policy.')
|
||||
),
|
||||
'lifetime': attributes.Schema(
|
||||
LIFETIME_ATTR: attributes.Schema(
|
||||
_('The safety assessment lifetime configuration of the ipsec '
|
||||
'policy.')
|
||||
),
|
||||
'name': attributes.Schema(
|
||||
NAME_ATTR: attributes.Schema(
|
||||
_('The name of the ipsec policy.')
|
||||
),
|
||||
'pfs': attributes.Schema(
|
||||
PFS_ATTR: attributes.Schema(
|
||||
_('The perfect forward secrecy of the ipsec policy.')
|
||||
),
|
||||
'tenant_id': attributes.Schema(
|
||||
TENANT_ID: attributes.Schema(
|
||||
_('The unique identifier of the tenant owning the ipsec policy.')
|
||||
),
|
||||
'transform_protocol': attributes.Schema(
|
||||
TRANSFORM_PROTOCOL_ATTR: attributes.Schema(
|
||||
_('The transform protocol of the ipsec policy.')
|
||||
),
|
||||
}
|
||||
|
@ -25,6 +25,12 @@ logger = logging.getLogger(__name__)
|
||||
class NovaFloatingIp(resource.Resource):
|
||||
PROPERTIES = (POOL,) = ('pool',)
|
||||
|
||||
ATTRIBUTES = (
|
||||
POOL_ATTR, IP,
|
||||
) = (
|
||||
'pool', 'ip',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
POOL: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -34,10 +40,10 @@ class NovaFloatingIp(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'pool': attributes.Schema(
|
||||
POOL_ATTR: attributes.Schema(
|
||||
_('Pool from which floating IP is allocated.')
|
||||
),
|
||||
'ip': attributes.Schema(
|
||||
IP: attributes.Schema(
|
||||
_('Allocated floating IP address.')
|
||||
),
|
||||
}
|
||||
@ -76,8 +82,8 @@ class NovaFloatingIp(resource.Resource):
|
||||
def _resolve_attribute(self, key):
|
||||
floating_ip = self._get_resource()
|
||||
attributes = {
|
||||
'pool': getattr(floating_ip, 'pool', None),
|
||||
'ip': floating_ip.ip
|
||||
self.POOL_ATTR: getattr(floating_ip, self.POOL_ATTR, None),
|
||||
self.IP: floating_ip.ip
|
||||
}
|
||||
return unicode(attributes[key])
|
||||
|
||||
|
@ -42,6 +42,12 @@ class KeyPair(resource.Resource):
|
||||
'name', 'save_private_key', 'public_key',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
PUBLIC_KEY_ATTR, PRIVATE_KEY,
|
||||
) = (
|
||||
'public_key', 'private_key',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -63,10 +69,10 @@ class KeyPair(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'public_key': attributes.Schema(
|
||||
PUBLIC_KEY: attributes.Schema(
|
||||
_('The public key.')
|
||||
),
|
||||
'private_key': attributes.Schema(
|
||||
PRIVATE_KEY: attributes.Schema(
|
||||
_('The private key if it has been saved.')
|
||||
),
|
||||
}
|
||||
|
@ -49,6 +49,12 @@ class OSDBInstance(resource.Resource):
|
||||
'name', 'password', 'host', 'databases',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
HOSTNAME, HREF,
|
||||
) = (
|
||||
'hostname', 'href',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -163,10 +169,10 @@ class OSDBInstance(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"hostname": attributes.Schema(
|
||||
HOSTNAME: attributes.Schema(
|
||||
_("Hostname of the instance")
|
||||
),
|
||||
"href": attributes.Schema(
|
||||
HREF: attributes.Schema(
|
||||
_("Api endpoint reference of the instance")
|
||||
),
|
||||
}
|
||||
@ -326,15 +332,15 @@ class OSDBInstance(resource.Resource):
|
||||
else:
|
||||
for link in self.dbinstance.links:
|
||||
if link['rel'] == 'self':
|
||||
self._href = link['href']
|
||||
self._href = link[self.HREF]
|
||||
break
|
||||
|
||||
return self._href
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
if name == 'hostname':
|
||||
if name == self.HOSTNAME:
|
||||
return self.dbinstance.hostname
|
||||
elif name == 'href':
|
||||
elif name == self.HREF:
|
||||
return self.href()
|
||||
|
||||
|
||||
|
@ -34,6 +34,12 @@ class RandomString(resource.Resource):
|
||||
'length', 'sequence', 'salt',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
VALUE,
|
||||
) = (
|
||||
'value',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
LENGTH: properties.Schema(
|
||||
properties.Schema.INTEGER,
|
||||
@ -63,7 +69,7 @@ class RandomString(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'value': attributes.Schema(
|
||||
VALUE: attributes.Schema(
|
||||
_('The random string generated by this resource. This value is '
|
||||
'also available by referencing the resource.')
|
||||
),
|
||||
@ -92,8 +98,8 @@ class RandomString(resource.Resource):
|
||||
self.resource_id_set(random_string)
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
if name == 'value':
|
||||
return self.data().get('value')
|
||||
if name == self.VALUE:
|
||||
return self.data().get(self.VALUE)
|
||||
|
||||
|
||||
def resource_mapping():
|
||||
|
@ -55,6 +55,12 @@ class ResourceGroup(stack_resource.StackResource):
|
||||
'type', 'properties',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
REFS,
|
||||
) = (
|
||||
'refs',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
COUNT: properties.Schema(
|
||||
properties.Schema.INTEGER,
|
||||
@ -86,7 +92,7 @@ class ResourceGroup(stack_resource.StackResource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"refs": attributes.Schema(
|
||||
REFS: attributes.Schema(
|
||||
_("A list of resource IDs for the resources in the group")
|
||||
),
|
||||
}
|
||||
@ -138,7 +144,7 @@ class ResourceGroup(stack_resource.StackResource):
|
||||
resource_method = getattr(self.nested()[str(n)], func)
|
||||
yield resource_method(*args)
|
||||
|
||||
method_name, method_call = (("FnGetRefId", []) if "refs" == key
|
||||
method_name, method_call = (("FnGetRefId", []) if self.REFS == key
|
||||
else ("FnGetAtt", [key]))
|
||||
return [val for val in get_aggregated_attr(method_name,
|
||||
*method_call)]
|
||||
|
@ -45,6 +45,12 @@ class S3Bucket(resource.Resource):
|
||||
'Key', 'Value',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
DOMAIN_NAME, WEBSITE_URL,
|
||||
) = (
|
||||
'DomainName', 'WebsiteURL',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
ACCESS_CONTROL: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -94,10 +100,10 @@ class S3Bucket(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'DomainName': attributes.Schema(
|
||||
DOMAIN_NAME: attributes.Schema(
|
||||
_('The DNS name of the specified bucket.')
|
||||
),
|
||||
'WebsiteURL': attributes.Schema(
|
||||
WEBSITE_URL: attributes.Schema(
|
||||
_('The website endpoint for the specified bucket.')
|
||||
),
|
||||
}
|
||||
@ -158,9 +164,9 @@ class S3Bucket(resource.Resource):
|
||||
def _resolve_attribute(self, name):
|
||||
url = self.swift().get_auth()[0]
|
||||
parsed = list(urlparse.urlparse(url))
|
||||
if name == 'DomainName':
|
||||
if name == self.DOMAIN_NAME:
|
||||
return parsed[1].split(':')[0]
|
||||
elif name == 'WebsiteURL':
|
||||
elif name == self.WEBSITE_URL:
|
||||
return '%s://%s%s/%s' % (parsed[0], parsed[1], parsed[2],
|
||||
self.resource_id)
|
||||
|
||||
|
@ -85,6 +85,14 @@ class Server(stack_user.StackUser):
|
||||
'POLL_SERVER_CFN', 'POLL_SERVER_HEAT'
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
SHOW, ADDRESSES, NETWORKS_ATTR, FIRST_ADDRESS, INSTANCE_NAME,
|
||||
ACCESSIPV4, ACCESSIPV6,
|
||||
) = (
|
||||
'show', 'addresses', 'networks', 'first_address', 'instance_name',
|
||||
'accessIPv4', 'accessIPv6',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -299,17 +307,17 @@ class Server(stack_user.StackUser):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'show': attributes.Schema(
|
||||
SHOW: attributes.Schema(
|
||||
_('A dict of all server details as returned by the API.')
|
||||
),
|
||||
'addresses': attributes.Schema(
|
||||
ADDRESSES: attributes.Schema(
|
||||
_('A dict of all network addresses with corresponding port_id.')
|
||||
),
|
||||
'networks': attributes.Schema(
|
||||
NETWORKS_ATTR: attributes.Schema(
|
||||
_('A dict of assigned network addresses of the form: '
|
||||
'{"public": [ip1, ip2...], "private": [ip3, ip4]}.')
|
||||
),
|
||||
'first_address': attributes.Schema(
|
||||
FIRST_ADDRESS: attributes.Schema(
|
||||
_('Convenience attribute to fetch the first assigned network '
|
||||
'address, or an empty string if nothing has been assigned at '
|
||||
'this time. Result may not be predictable if the server has '
|
||||
@ -321,14 +329,14 @@ class Server(stack_user.StackUser):
|
||||
'[<server name>, networks, <network name>, 0]}"')
|
||||
)
|
||||
),
|
||||
'instance_name': attributes.Schema(
|
||||
INSTANCE_NAME: attributes.Schema(
|
||||
_('AWS compatible instance name.')
|
||||
),
|
||||
'accessIPv4': attributes.Schema(
|
||||
ACCESSIPV4: attributes.Schema(
|
||||
_('The manually assigned alternative public IPv4 address '
|
||||
'of the server.')
|
||||
),
|
||||
'accessIPv6': attributes.Schema(
|
||||
ACCESSIPV6: attributes.Schema(
|
||||
_('The manually assigned alternative public IPv6 address '
|
||||
'of the server.')
|
||||
),
|
||||
@ -607,7 +615,7 @@ class Server(stack_user.StackUser):
|
||||
return nets
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
if name == 'first_address':
|
||||
if name == self.FIRST_ADDRESS:
|
||||
return nova_utils.server_to_ipaddress(
|
||||
self.nova(), self.resource_id) or ''
|
||||
try:
|
||||
@ -616,17 +624,17 @@ class Server(stack_user.StackUser):
|
||||
logger.warn(_('Instance (%(server)s) not found: %(ex)s') % {
|
||||
'server': self.resource_id, 'ex': ex})
|
||||
return ''
|
||||
if name == 'addresses':
|
||||
if name == self.ADDRESSES:
|
||||
return self._add_port_for_address(server)
|
||||
if name == 'networks':
|
||||
if name == self.NETWORKS_ATTR:
|
||||
return server.networks
|
||||
if name == 'instance_name':
|
||||
if name == self.INSTANCE_NAME:
|
||||
return server._info.get('OS-EXT-SRV-ATTR:instance_name')
|
||||
if name == 'accessIPv4':
|
||||
if name == self.ACCESSIPV4:
|
||||
return server.accessIPv4
|
||||
if name == 'accessIPv6':
|
||||
if name == self.ACCESSIPV6:
|
||||
return server.accessIPv6
|
||||
if name == 'show':
|
||||
if name == self.SHOW:
|
||||
return server._info
|
||||
|
||||
def add_dependencies(self, deps):
|
||||
|
@ -58,6 +58,12 @@ class SoftwareConfig(resource.Resource):
|
||||
'name', 'description', 'type', 'default', 'error_output'
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
CONFIG_ATTR,
|
||||
) = (
|
||||
'config',
|
||||
)
|
||||
|
||||
input_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -141,7 +147,7 @@ class SoftwareConfig(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
"config": attributes.Schema(
|
||||
CONFIG_ATTR: attributes.Schema(
|
||||
_("The config value of the software config.")
|
||||
),
|
||||
}
|
||||
@ -169,7 +175,7 @@ class SoftwareConfig(resource.Resource):
|
||||
"config" returns the config value of the software config. If the
|
||||
software config does not exist, returns an empty string.
|
||||
'''
|
||||
if name == self.CONFIG and self.resource_id:
|
||||
if name == self.CONFIG_ATTR and self.resource_id:
|
||||
try:
|
||||
return self.get_software_config(self.heat(), self.resource_id)
|
||||
except exception.SoftwareConfigMissing:
|
||||
|
@ -77,7 +77,7 @@ class SoftwareDeployment(signal_responder.SignalResponder):
|
||||
resource.Resource.RESUME,
|
||||
)
|
||||
|
||||
DEPLOY_ATTRIBUTES = (
|
||||
ATTRIBUTES = (
|
||||
STDOUT, STDERR, STATUS_CODE
|
||||
) = (
|
||||
'deploy_stdout', 'deploy_stderr', 'deploy_status_code'
|
||||
@ -454,7 +454,7 @@ class SoftwareDeployment(signal_responder.SignalResponder):
|
||||
status = self.FAILED
|
||||
status_reasons[out_key] = details[out_key]
|
||||
|
||||
for out_key in self.DEPLOY_ATTRIBUTES:
|
||||
for out_key in self.ATTRIBUTES:
|
||||
ov[out_key] = details.get(out_key)
|
||||
|
||||
if status == self.FAILED:
|
||||
@ -479,7 +479,7 @@ class SoftwareDeployment(signal_responder.SignalResponder):
|
||||
# to find out if the key is valid
|
||||
sc = self.heat().software_configs.get(self.properties[self.CONFIG])
|
||||
output_keys = [output['name'] for output in sc.outputs]
|
||||
if key not in output_keys and key not in self.DEPLOY_ATTRIBUTES:
|
||||
if key not in output_keys and key not in self.ATTRIBUTES:
|
||||
raise exception.InvalidTemplateAttribute(resource=self.name,
|
||||
key=key)
|
||||
|
||||
|
@ -32,6 +32,14 @@ class SwiftContainer(resource.Resource):
|
||||
'X-Account-Meta'
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
DOMAIN_NAME, WEBSITE_URL, ROOT_URL, OBJECT_COUNT, BYTES_USED,
|
||||
HEAD_CONTAINER,
|
||||
) = (
|
||||
'DomainName', 'WebsiteURL', 'RootURL', 'ObjectCount', 'BytesUsed',
|
||||
'HeadContainer',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
NAME: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -65,22 +73,22 @@ class SwiftContainer(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'DomainName': attributes.Schema(
|
||||
DOMAIN_NAME: attributes.Schema(
|
||||
_('The host from the container URL.')
|
||||
),
|
||||
'WebsiteURL': attributes.Schema(
|
||||
WEBSITE_URL: attributes.Schema(
|
||||
_('The URL of the container.')
|
||||
),
|
||||
'RootURL': attributes.Schema(
|
||||
ROOT_URL: attributes.Schema(
|
||||
_('The parent URL of the container.')
|
||||
),
|
||||
'ObjectCount': attributes.Schema(
|
||||
OBJECT_COUNT: attributes.Schema(
|
||||
_('The number of objects stored in the container.')
|
||||
),
|
||||
'BytesUsed': attributes.Schema(
|
||||
BYTES_USED: attributes.Schema(
|
||||
_('The number of bytes stored in the container.')
|
||||
),
|
||||
'HeadContainer': attributes.Schema(
|
||||
HEAD_CONTAINER: attributes.Schema(
|
||||
_('A map containing all headers for the container.')
|
||||
),
|
||||
}
|
||||
@ -147,26 +155,26 @@ class SwiftContainer(resource.Resource):
|
||||
|
||||
def FnGetAtt(self, key):
|
||||
parsed = list(urlparse.urlparse(self.swift().url))
|
||||
if key == 'DomainName':
|
||||
if key == self.DOMAIN_NAME:
|
||||
return parsed[1].split(':')[0]
|
||||
elif key == 'WebsiteURL':
|
||||
elif key == self.WEBSITE_URL:
|
||||
return '%s://%s%s/%s' % (parsed[0], parsed[1], parsed[2],
|
||||
self.resource_id)
|
||||
elif key == 'RootURL':
|
||||
elif key == self.ROOT_URL:
|
||||
return '%s://%s%s' % (parsed[0], parsed[1], parsed[2])
|
||||
elif self.resource_id and key in (
|
||||
'ObjectCount', 'BytesUsed', 'HeadContainer'):
|
||||
self.OBJECT_COUNT, self.BYTES_USED, self.HEAD_CONTAINER):
|
||||
try:
|
||||
headers = self.swift().head_container(self.resource_id)
|
||||
except clients.swiftclient.ClientException as ex:
|
||||
logger.warn(_("Head container failed: %s") % ex)
|
||||
return None
|
||||
else:
|
||||
if key == 'ObjectCount':
|
||||
if key == self.OBJECT_COUNT:
|
||||
return headers['x-container-object-count']
|
||||
elif key == 'BytesUsed':
|
||||
elif key == self.BYTES_USED:
|
||||
return headers['x-container-bytes-used']
|
||||
elif key == 'HeadContainer':
|
||||
elif key == self.HEAD_CONTAINER:
|
||||
return headers
|
||||
else:
|
||||
raise exception.InvalidTemplateAttribute(resource=self.name,
|
||||
|
@ -132,6 +132,12 @@ class AccessKey(resource.Resource):
|
||||
'Serial', 'UserName', 'Status',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
USER_NAME, SECRET_ACCESS_KEY,
|
||||
) = (
|
||||
'UserName', 'SecretAccessKey',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
SERIAL: properties.Schema(
|
||||
properties.Schema.INTEGER,
|
||||
@ -154,10 +160,10 @@ class AccessKey(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'UserName': attributes.Schema(
|
||||
USER_NAME: attributes.Schema(
|
||||
_('Username associated with the AccessKey.')
|
||||
),
|
||||
'SecretAccessKey': attributes.Schema(
|
||||
SECRET_ACCESS_KEY: attributes.Schema(
|
||||
_('Keypair secret key.')
|
||||
),
|
||||
}
|
||||
@ -244,9 +250,9 @@ class AccessKey(resource.Resource):
|
||||
return self._secret or '000-000-000'
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
if name == 'UserName':
|
||||
if name == self.USER_NAME:
|
||||
return self.properties[self.USER_NAME]
|
||||
elif name == 'SecretAccessKey':
|
||||
elif name == self.SECRET_ACCESS_KEY:
|
||||
return self._secret_accesskey()
|
||||
|
||||
def _register_access_key(self):
|
||||
|
@ -424,6 +424,16 @@ class CinderVolume(Volume):
|
||||
'source_volid',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
AVAILABILITY_ZONE_ATTR, SIZE_ATTR, SNAPSHOT_ID_ATTR, DISPLAY_NAME,
|
||||
DISPLAY_DESCRIPTION, VOLUME_TYPE_ATTR, METADATA_ATTR,
|
||||
SOURCE_VOLID_ATTR, STATUS, CREATED_AT, BOOTABLE,
|
||||
) = (
|
||||
'availability_zone', 'size', 'snapshot_id', 'display_name',
|
||||
'display_description', 'volume_type', 'metadata',
|
||||
'source_volid', 'status', 'created_at', 'bootable',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
AVAILABILITY_ZONE: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -483,37 +493,37 @@ class CinderVolume(Volume):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'availability_zone': attributes.Schema(
|
||||
AVAILABILITY_ZONE_ATTR: attributes.Schema(
|
||||
_('The availability zone in which the volume is located.')
|
||||
),
|
||||
'size': attributes.Schema(
|
||||
SIZE_ATTR: attributes.Schema(
|
||||
_('The size of the volume in GB.')
|
||||
),
|
||||
'snapshot_id': attributes.Schema(
|
||||
SNAPSHOT_ID_ATTR: attributes.Schema(
|
||||
_('The snapshot the volume was created from, if any.')
|
||||
),
|
||||
'display_name': attributes.Schema(
|
||||
DISPLAY_NAME: attributes.Schema(
|
||||
_('Name of the volume.')
|
||||
),
|
||||
'display_description': attributes.Schema(
|
||||
DISPLAY_DESCRIPTION: attributes.Schema(
|
||||
_('Description of the volume.')
|
||||
),
|
||||
'volume_type': attributes.Schema(
|
||||
VOLUME_TYPE_ATTR: attributes.Schema(
|
||||
_('The type of the volume mapping to a backend, if any.')
|
||||
),
|
||||
'metadata': attributes.Schema(
|
||||
METADATA_ATTR: attributes.Schema(
|
||||
_('Key/value pairs associated with the volume.')
|
||||
),
|
||||
'source_volid': attributes.Schema(
|
||||
SOURCE_VOLID_ATTR: attributes.Schema(
|
||||
_('The volume used as source, if any.')
|
||||
),
|
||||
'status': attributes.Schema(
|
||||
STATUS: attributes.Schema(
|
||||
_('The current status of the volume.')
|
||||
),
|
||||
'created_at': attributes.Schema(
|
||||
CREATED_AT: attributes.Schema(
|
||||
_('The timestamp indicating volume creation.')
|
||||
),
|
||||
'bootable': attributes.Schema(
|
||||
BOOTABLE: attributes.Schema(
|
||||
_('Boolean indicating if the volume can be booted or not.')
|
||||
),
|
||||
}
|
||||
|
@ -150,6 +150,12 @@ class WaitCondition(resource.Resource):
|
||||
'Handle', 'Timeout', 'Count',
|
||||
)
|
||||
|
||||
ATTRIBUTES = (
|
||||
DATA,
|
||||
) = (
|
||||
'Data',
|
||||
)
|
||||
|
||||
properties_schema = {
|
||||
HANDLE: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -179,7 +185,7 @@ class WaitCondition(resource.Resource):
|
||||
}
|
||||
|
||||
attributes_schema = {
|
||||
'Data': attributes.Schema(
|
||||
DATA: attributes.Schema(
|
||||
_('JSON serialized dict containing data associated with wait '
|
||||
'condition signals sent to the handle.')
|
||||
),
|
||||
@ -275,7 +281,7 @@ class WaitCondition(resource.Resource):
|
||||
res = {}
|
||||
handle_res_name = self._get_handle_resource_name()
|
||||
handle = self.stack[handle_res_name]
|
||||
if key == 'Data':
|
||||
if key == self.DATA:
|
||||
meta = handle.metadata_get(refresh=True)
|
||||
# Note, can't use a dict generator on python 2.6, hence:
|
||||
res = dict([(k, meta[k]['Data']) for k in meta])
|
||||
|
Loading…
Reference in New Issue
Block a user