EMMA Coverage Report (generated Fri Apr 27 15:03:37 EDT 2012)
[all classes][org.jclouds.ec2.options]

COVERAGE SUMMARY FOR SOURCE FILE [RegisterImageOptions.java]

nameclass, %method, %block, %line, %
RegisterImageOptions.java100% (2/2)64%  (9/14)80%  (77/96)80%  (17.5/22)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RegisterImageOptions100% (1/1)56%  (5/9)74%  (45/61)71%  (10/14)
getArchitecture (): String 0%   (0/1)0%   (0/4)0%   (0/1)
getDescription (): String 0%   (0/1)0%   (0/4)0%   (0/1)
getKernelId (): String 0%   (0/1)0%   (0/4)0%   (0/1)
getRamdiskId (): String 0%   (0/1)0%   (0/4)0%   (0/1)
RegisterImageOptions (): void 100% (1/1)100% (3/3)100% (2/2)
asArchitecture (Image$Architecture): RegisterImageOptions 100% (1/1)100% (12/12)100% (2/2)
withDescription (String): RegisterImageOptions 100% (1/1)100% (10/10)100% (2/2)
withKernelId (String): RegisterImageOptions 100% (1/1)100% (10/10)100% (2/2)
withRamdisk (String): RegisterImageOptions 100% (1/1)100% (10/10)100% (2/2)
     
class RegisterImageOptions$Builder100% (1/1)80%  (4/5)91%  (32/35)89%  (8/9)
RegisterImageOptions$Builder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
asArchitecture (Image$Architecture): RegisterImageOptions 100% (1/1)100% (8/8)100% (2/2)
withDescription (String): RegisterImageOptions 100% (1/1)100% (8/8)100% (2/2)
withKernelId (String): RegisterImageOptions 100% (1/1)100% (8/8)100% (2/2)
withRamdisk (String): RegisterImageOptions 100% (1/1)100% (8/8)100% (2/2)

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 */
19package org.jclouds.ec2.options;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import org.jclouds.ec2.domain.Image.Architecture;
24import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
25 
26/**
27 * Contains options supported in the Form API for the RegisterImage operation. <h2>
28 * Usage</h2> The recommended way to instantiate a RegisterImageOptions object is to statically
29 * import RegisterImageOptions.Builder.* and invoke a static creation method followed by an instance
30 * mutator (if needed):
31 * <p/>
32 * <code>
33 * import static org.jclouds.ec2.options.RegisterImageOptions.Builder.*
34 * <p/>
35 * EC2Client connection = // get connection
36 * String imageId = connection.getImageServices().registerImageFromManifest(...withArchitecture(Architecture.I386).withDescription("description"));
37 * <code>
38 * 
39 * @author Adrian Cole
40 * @see <a
41 *      href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-form-RegisterImage.html"
42 *      />
43 */
44public class RegisterImageOptions extends BaseEC2RequestOptions {
45 
46   /**
47    * The architecture of the image.
48    */
49   public RegisterImageOptions asArchitecture(Architecture architecture) {
50      formParameters.put("Architecture", checkNotNull(architecture, "architecture").value());
51      return this;
52   }
53 
54   String getArchitecture() {
55      return getFirstFormOrNull("Architecture");
56   }
57 
58   /**
59    *The description of the AMI. "Up to 255 characters."
60    */
61   public RegisterImageOptions withDescription(String info) {
62      formParameters.put("Description", checkNotNull(info, "info"));
63      return this;
64   }
65 
66   String getDescription() {
67      return getFirstFormOrNull("Description");
68   }
69 
70   /**
71    * The ID of the kernel to select.
72    */
73   public RegisterImageOptions withKernelId(String kernelId) {
74      formParameters.put("KernelId", checkNotNull(kernelId, "kernelId"));
75      return this;
76   }
77 
78   String getKernelId() {
79      return getFirstFormOrNull("KernelId");
80   }
81 
82   /**
83    * The ID of the RAM disk to select. Some kernels require additional drivers at launch. Check the
84    * kernel requirements for information on whether you need to specify a RAM disk. To find kernel
85    * requirements, refer to the Resource Center and search for the kernel ID.
86    */
87   public RegisterImageOptions withRamdisk(String ramDiskId) {
88      formParameters.put("RamdiskId", checkNotNull(ramDiskId, "ramDiskId"));
89      return this;
90   }
91 
92   String getRamdiskId() {
93      return getFirstFormOrNull("RamdiskId");
94   }
95 
96   public static class Builder {
97      /**
98       * @see RegisterImageOptions#asArchitecture(Architecture)
99       */
100      public static RegisterImageOptions asArchitecture(Architecture architecture) {
101         RegisterImageOptions options = new RegisterImageOptions();
102         return options.asArchitecture(architecture);
103      }
104 
105      /**
106       * @see RegisterImageOptions#withDescription(String)
107       */
108      public static RegisterImageOptions withDescription(String additionalInfo) {
109         RegisterImageOptions options = new RegisterImageOptions();
110         return options.withDescription(additionalInfo);
111      }
112 
113      /**
114       * @see RegisterImageOptions#withKernelId(String)
115       */
116      public static RegisterImageOptions withKernelId(String kernelId) {
117         RegisterImageOptions options = new RegisterImageOptions();
118         return options.withKernelId(kernelId);
119      }
120 
121      /**
122       * @see RegisterImageOptions#withRamdisk(String)
123       */
124      public static RegisterImageOptions withRamdisk(String ramdiskId) {
125         RegisterImageOptions options = new RegisterImageOptions();
126         return options.withRamdisk(ramdiskId);
127      }
128 
129   }
130}

[all classes][org.jclouds.ec2.options]
EMMA 2.0.5312 (C) Vladimir Roubtsov