Show Table of Contents
2.7. リソースに対するアクションの実行
以下の例では、リソースに対してアクションを実行する方法について説明します。この例では、「test」という名前の仮想マシンを起動します。
手順2.3 リソースに対するアクションの実行
- リソースのインスタンスを宣言します。
VM vm = api.getVMs().get("test"); - リソースに送るアクションパラメーターを宣言します。
Action actionParam = new Action(); org.ovirt.engine.sdk.entities.VM vmParam = new org.ovirt.engine.sdk.entities.VM(); actionParam.setVm(vmParam);
- アクションを実行します。
Action res = vm.start(actionParam);
代わりに、内部メソッドとしてアクションを実行することも可能です。
Action res = vm.start(new Action()
{
{
setVm(new org.ovirt.engine.sdk.entities.VM());
}
});
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.