1 /**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. 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,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
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 }