cluster: Use typed props instead of *_id

This change converts several props on cluster resources to their typed
equivalent, allowing either an ID or an actual Resource to be passed for
that value.

Change-Id: I62894903239160944c1c2ec474b06b25ed64ed28
This commit is contained in:
Brian Curtin 2015-12-15 17:37:34 -06:00
parent a4238bb8d0
commit a5bf184ebd
2 changed files with 6 additions and 3 deletions

View File

@ -11,6 +11,7 @@
# under the License.
from openstack.cluster import cluster_service
from openstack.cluster.v1 import profile as _profile
from openstack import resource
from openstack import utils
@ -33,7 +34,7 @@ class Cluster(resource.Resource):
#: The name of the cluster.
name = resource.prop('name')
#: The ID of the profile used by this cluster.
profile_id = resource.prop('profile_id')
profile = resource.prop('profile_id', type=_profile.Profile)
#: The ID of the user who created this cluster, thus the owner of it.
user = resource.prop('user')
#: The ID of the project this cluster belongs to.

View File

@ -11,6 +11,8 @@
# under the License.
from openstack.cluster import cluster_service
from openstack.cluster.v1 import cluster as _cluster
from openstack.cluster.v1 import profile as _profile
from openstack import resource
from openstack import utils
@ -37,9 +39,9 @@ class Node(resource.Resource):
physical_id = resource.prop('physical_id')
#: The ID of the cluster in which this node is a member.
#: A node is an orphan node if this field is empty.
cluster_id = resource.prop('cluster_id')
cluster = resource.prop('cluster_id', type=_cluster.Cluster)
#: The ID of the profile used by this node.
profile_id = resource.prop('profile_id')
profile = resource.prop('profile_id', type=_profile.Profile)
#: The ID of the project this node belongs to.
project = resource.prop('project')
#: The name of the profile used by this node.