| 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 java.util.Arrays; |
| 22 | import java.util.Set; |
| 23 | |
| 24 | import org.jclouds.ec2.options.internal.BaseEC2RequestOptions; |
| 25 | |
| 26 | /** |
| 27 | * Contains options supported in the Form API for the DescribeAvailabilityZones operation. <h2> |
| 28 | * Usage</h2> The recommended way to instantiate a DescribeAvailabilityZonesOptions object is to |
| 29 | * statically import DescribeAvailabilityZonesOptions.Builder.* and invoke a static creation method |
| 30 | * followed by an instance mutator (if needed): |
| 31 | * <p/> |
| 32 | * <code> |
| 33 | * import static org.jclouds.ec2.options.DescribeAvailabilityZonesOptions.Builder.* |
| 34 | * <p/> |
| 35 | * EC2Client connection = // get connection |
| 36 | * Future<Set<ImageMetadata>> images = connection.getAvailabilityZoneAndRegionServices().describeAvailabilityZones(zones("us-east-1a", "us-east-1b")); |
| 37 | * <code> |
| 38 | * |
| 39 | * @author Adrian Cole |
| 40 | * @see <a |
| 41 | * href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-form-DescribeAvailabilityZones.html" |
| 42 | * /> |
| 43 | */ |
| 44 | public class DescribeAvailabilityZonesOptions extends BaseEC2RequestOptions { |
| 45 | |
| 46 | /** |
| 47 | * Availability Zone name. |
| 48 | */ |
| 49 | public DescribeAvailabilityZonesOptions zones(String... zones) { |
| 50 | String[] zoneStrings = Arrays.copyOf(zones, zones.length, String[].class); |
| 51 | indexFormValuesWithPrefix("ZoneName", zoneStrings); |
| 52 | return this; |
| 53 | } |
| 54 | |
| 55 | public Set<String> getZones() { |
| 56 | return getFormValuesWithKeysPrefixedBy("ZoneName."); |
| 57 | } |
| 58 | |
| 59 | public static class Builder { |
| 60 | |
| 61 | /** |
| 62 | * @see DescribeAvailabilityZonesOptions#zones(String...) |
| 63 | */ |
| 64 | public static DescribeAvailabilityZonesOptions availabilityZones(String... zones) { |
| 65 | DescribeAvailabilityZonesOptions options = new DescribeAvailabilityZonesOptions(); |
| 66 | return options.zones(zones); |
| 67 | } |
| 68 | |
| 69 | } |
| 70 | } |