1212
1313from openstack .cluster .v1 import action
1414from openstack .cluster .v1 import cluster
15+ from openstack .cluster .v1 import node
1516from openstack .cluster .v1 import policy
1617from openstack import proxy
1718
@@ -83,6 +84,7 @@ def clusters(self, **query):
8384 whether a cluster should be included in the list result.
8485 * sort_keys: A list of key names for sorting the resulted list.
8586 * sort_dir: Direction for sorting, and its valid values are 'asc'
87+ and 'desc'.
8688 * limit: Requests a specified size of returned items from the
8789 query. Returns a number of items up to the specified limit
8890 value.
@@ -108,6 +110,92 @@ def update_cluster(self, value, **attrs):
108110 """
109111 return self ._update (cluster .Cluster , value , ** attrs )
110112
113+ def create_node (self , ** attrs ):
114+ """Create a new node from attributes.
115+
116+ :param dict attrs: Keyword arguments that will be used to create a
117+ :class:`~openstack.cluster.v1.node.Node`, it is comprised
118+ of the properties on the Node class.
119+
120+ :returns: The results of node creation.
121+ :rtype: :class:`~openstack.cluster.v1.node.Node`.
122+ """
123+ return self ._create (node .Node , ** attrs )
124+
125+ def delete_node (self , value , ignore_missing = True ):
126+ """Delete a node.
127+
128+ :param value: The value can be either the name or ID of a node or a
129+ :class:`~openstack.cluster.v1.node.Node` instance.
130+ :param bool ignore_missing: When set to ``False``, an exception
131+ :class:`~openstack.exceptions.ResourceNotFound` will be raised when
132+ the node could not be found. When set to ``True``, no exception
133+ will be raised when attempting to delete a non-existent node.
134+
135+ :returns: ``None``
136+ """
137+ self ._delete (node .Node , value , ignore_missing = ignore_missing )
138+
139+ def find_node (self , value , ignore_missing = True ):
140+ """Find a single node.
141+
142+ :param value: The name or ID of a node.
143+ :returns: One :class:`~openstack.cluster.v1.node.Node` object or None.
144+ """
145+ return node .Node .find (self .session , value ,
146+ ignore_missing = ignore_missing )
147+
148+ def get_node (self , value ):
149+ """Get a single node.
150+
151+ :param value: The value can be the name or ID of a node or a
152+ :class:`~openstack.cluster.v1.node.Node` instance.
153+
154+ :returns: One :class:`~openstack.cluster.v1.node.Node`
155+ :raises: :class:`~openstack.exceptions.ResourceNotFound` when no
156+ node matching the name or ID could be found.
157+ """
158+ return self ._get (node .Node , value )
159+
160+ def nodes (self , ** query ):
161+ """Retrieve a generator of nodes.
162+
163+ :param kwargs \*\*query: Optional query parameters to be sent to
164+ restrict the nodes to be returned. Available parameters include:
165+
166+ * cluster_id: A string including the name or ID of a cluster to
167+ which the resulted node(s) is a member.
168+ * show_deleted: A boolean value indicating whether soft-deleted
169+ nodes should be returned as well.
170+ * filters: A list of key-value pairs for server to determine
171+ whether a node should be included in the list result.
172+ * sort_keys: A list of key names for sorting the resulted list.
173+ * sort_dir: Direction for sorting, and its valid values are 'asc'
174+ and 'desc'.
175+ * limit: Requests at most the specified number of items be
176+ returned from the query.
177+ * marker: Specifies the ID of the last-seen node. Use the limit
178+ parameter to make an initial limited request and use the ID of
179+ the last-seen node from the response as the marker parameter
180+ value in a subsequent limited request.
181+
182+ :returns: A generator of node instances.
183+ """
184+ return self ._list (node .Node , paginated = True , ** query )
185+
186+ def update_node (self , value , ** attrs ):
187+ """Update a node.
188+
189+ :param value: Either the name or the ID of the node, or an instance
190+ of :class:`~openstack.cluster.v1.node.Node`.
191+ :param attrs: The attributes to update on the node represented by
192+ the ``value`` parameter.
193+
194+ :returns: The updated node.
195+ :rtype: :class:`~openstack.cluster.v1.node.Node`
196+ """
197+ return self ._update (node .Node , value , ** attrs )
198+
111199 def create_policy (self , ** attrs ):
112200 """Create a new policy from attributes.
113201
0 commit comments