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.ec2.options; |
20 | � |
21 | import�static�com.google.common.base.Preconditions.checkNotNull; |
22 | � |
23 | import�java.util.Set; |
24 | � |
25 | import�org.jclouds.ec2.options.internal.BaseEC2RequestOptions; |
26 | � |
27 | /** |
28 | �*�Contains�options�supported�in�the�Form�API�for�the�DescribeImages�operation.�<h2> |
29 | �*�Usage</h2>�The�recommended�way�to�instantiate�a�DescribeImagesOptions�object�is�to�statically |
30 | �*�import�DescribeImagesOptions.Builder.*�and�invoke�a�static�creation�method�followed�by�an |
31 | �*�instance�mutator�(if�needed): |
32 | �*�<p/> |
33 | �*�<code> |
34 | �*�import�static�org.jclouds.ec2.options.DescribeImagesOptions.Builder.* |
35 | �*�<p/> |
36 | �*�EC2Client�connection�=�//�get�connection |
37 | �*�Future<Set<ImageMetadata>>�images�=�connection.getAMIServices().describeImages(executableBy("123125").imageIds(1000,�1004)); |
38 | �*�<code> |
39 | �*� |
40 | �*�@author�Adrian�Cole |
41 | �*�@see�<a |
42 | �*������href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-form-DescribeImages.html" |
43 | �*������/> |
44 | �*/ |
45 | public�class�DescribeImagesOptions�extends�BaseEC2RequestOptions�{ |
46 | ���public�static�final�DescribeImagesOptions�NONE�=�new�DescribeImagesOptions(); |
47 | � |
48 | ���/** |
49 | ����*�AMIs�for�which�the�specified�user�has�explicit�launch�permissions. |
50 | ����*� |
51 | ����*/ |
52 | ���public�DescribeImagesOptions�executableBy(String�identityId)�{ |
53 | ������formParameters.put("ExecutableBy",�checkNotNull(identityId,�"identityId")); |
54 | ������return�this; |
55 | ���} |
56 | � |
57 | ���public�String�getExecutableBy()�{ |
58 | ������return�getFirstFormOrNull("ExecutableBy"); |
59 | ���} |
60 | � |
61 | ���/** |
62 | ����*�AMI�IDs�to�describe. |
63 | ����*/ |
64 | ���public�DescribeImagesOptions�imageIds(String...�imageIds)�{ |
65 | ������indexFormValuesWithPrefix("ImageId",�imageIds); |
66 | ������return�this; |
67 | ���} |
68 | � |
69 | ���public�DescribeImagesOptions�imageIds(Iterable<String>�imageIds)�{ |
70 | ������indexFormValuesWithPrefix("ImageId",�imageIds); |
71 | ������return�this; |
72 | ���} |
73 | � |
74 | ���public�Set<String>�getImageIds()�{ |
75 | ������return�getFormValuesWithKeysPrefixedBy("ImageId."); |
76 | ���} |
77 | � |
78 | ���/** |
79 | ����*�Returns�AMIs�owned�by�the�specified�owner.�Multiple�owners�can�be�specified. |
80 | ����*/ |
81 | ���public�DescribeImagesOptions�ownedBy(String...�owners)�{ |
82 | ������indexFormValuesWithPrefix("Owner",�owners); |
83 | ������return�this; |
84 | ���} |
85 | � |
86 | ���public�Set<String>�getOwners()�{ |
87 | ������return�getFormValuesWithKeysPrefixedBy("Owner."); |
88 | ���} |
89 | � |
90 | ���public�static�class�Builder�{ |
91 | � |
92 | ������/** |
93 | �������*�@see�DescribeImagesOptions#executableBy(String�) |
94 | �������*/ |
95 | ������public�static�DescribeImagesOptions�executableBy(String�identityId)�{ |
96 | ���������DescribeImagesOptions�options�=�new�DescribeImagesOptions(); |
97 | ���������return�options.executableBy(identityId); |
98 | ������} |
99 | � |
100 | ������/** |
101 | �������*�@see�DescribeImagesOptions#imageIds(String[]�) |
102 | �������*/ |
103 | ������public�static�DescribeImagesOptions�imageIds(String...�imageIds)�{ |
104 | ���������DescribeImagesOptions�options�=�new�DescribeImagesOptions(); |
105 | ���������return�options.imageIds(imageIds); |
106 | ������} |
107 | � |
108 | ������/** |
109 | �������*�@see�DescribeImagesOptions#ownedBy(String[]�) |
110 | �������*/ |
111 | ������public�static�DescribeImagesOptions�ownedBy(String...�owners)�{ |
112 | ���������DescribeImagesOptions�options�=�new�DescribeImagesOptions(); |
113 | ���������return�options.ownedBy(owners); |
114 | ������} |
115 | � |
116 | ���} |
117 | } |