Show Table of Contents
3.7. 更新集合中的资源
要更新一个资源,您需要先从集合中获得它,然后修改所需的参数,为资源调用
update 方法来保存所做的修改。对参数的修改操作是通过使用所获取的资源的 set_* 方法进行的。
例 3.7. 更新资源
在这个示例中,名为
DemoDataCenter 的数据中心的描述信息被更新。
dc = api.datacenters.get("DemoDataCenter")
dc.set_description("This data center description provided using the Python SDK")
dc.update()

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.