1 /**
2 *
3 * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4 *
5 * ====================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ====================================================================
18 */
19 package org.jclouds.trmk.vcloud_0_8.options;
20
21 import static com.google.common.base.Preconditions.*;
22
23 /**
24 *
25 * @author Adrian Cole
26 *
27 */
28 public class CloneVAppOptions {
29
30 private boolean deploy;
31 private boolean powerOn;
32 private String description;
33
34 /**
35 * the clone should be deployed after it is created
36 */
37 public CloneVAppOptions deploy() {
38 this.deploy = true;
39 return this;
40 }
41
42 /**
43 * the clone should be powered on after it is deployed
44 */
45 public CloneVAppOptions powerOn() {
46 checkState(deploy, "must set deploy before setting powerOn");
47 powerOn = true;
48 return this;
49 }
50
51 /**
52 * the clone should be powered on after it is deployed
53 */
54 public CloneVAppOptions withDescription(String description) {
55 checkNotNull(description, "description");
56 this.description = description;
57 return this;
58 }
59
60 public boolean isDeploy() {
61 return deploy;
62 }
63
64 public boolean isPowerOn() {
65 return powerOn;
66 }
67
68 public String getDescription() {
69 return description;
70 }
71
72 public static class Builder {
73
74 /**
75 * @see CloneVAppOptions#deploy()
76 */
77 public static CloneVAppOptions deploy() {
78 CloneVAppOptions options = new CloneVAppOptions();
79 return options.deploy();
80 }
81
82 /**
83 * @see CloneVAppOptions#powerOn()
84 */
85 public static CloneVAppOptions powerOn() {
86 CloneVAppOptions options = new CloneVAppOptions();
87 return options.powerOn();
88 }
89
90 /**
91 * @see CloneVAppOptions#withDescription(String)
92 */
93 public static CloneVAppOptions withDescription(String description) {
94 CloneVAppOptions options = new CloneVAppOptions();
95 return options.withDescription(description);
96 }
97 }
98
99 }