| 1 | /* | 
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more | 
| 3 | * contributor license agreements.  See the NOTICE file distributed with | 
| 4 | * this work for additional information regarding copyright ownership. | 
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | 
| 6 | * (the "License"); you may not use this file except in compliance with | 
| 7 | * the License.  You may obtain a copy of the License at | 
| 8 | * | 
| 9 | *     http://www.apache.org/licenses/LICENSE-2.0 | 
| 10 | * | 
| 11 | * Unless required by applicable law or agreed to in writing, software | 
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | 
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
| 14 | * See the License for the specific language governing permissions and | 
| 15 | * limitations under the License. | 
| 16 | */ | 
| 17 | package org.jclouds.glesys; | 
| 18 |  | 
| 19 | import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE; | 
| 20 | import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES; | 
| 21 | import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONE; | 
| 22 | import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONES; | 
| 23 |  | 
| 24 | import java.net.URI; | 
| 25 | import java.util.Properties; | 
| 26 |  | 
| 27 | import org.jclouds.providers.ProviderMetadata; | 
| 28 | import org.jclouds.providers.internal.BaseProviderMetadata; | 
| 29 |  | 
| 30 | /** | 
| 31 | * Implementation of {@link org.jclouds.types.ProviderMetadata} for GleSYS. | 
| 32 | * @author Adrian Cole | 
| 33 | */ | 
| 34 | public class GleSYSProviderMetadata extends BaseProviderMetadata { | 
| 35 |  | 
| 36 | public static Builder builder() { | 
| 37 | return new Builder(); | 
| 38 | } | 
| 39 |  | 
| 40 | @Override | 
| 41 | public Builder toBuilder() { | 
| 42 | return builder().fromProviderMetadata(this); | 
| 43 | } | 
| 44 |  | 
| 45 | public GleSYSProviderMetadata() { | 
| 46 | super(builder()); | 
| 47 | } | 
| 48 |  | 
| 49 | public GleSYSProviderMetadata(Builder builder) { | 
| 50 | super(builder); | 
| 51 | } | 
| 52 |  | 
| 53 | public static Properties defaultProperties() { | 
| 54 | Properties properties = new Properties(); | 
| 55 | properties.setProperty(PROPERTY_ZONES, "Amsterdam,Falkenberg,New York City,Stockholm"); | 
| 56 | properties.setProperty(PROPERTY_ZONE + ".Amsterdam." + ISO3166_CODES, "NL-NH"); | 
| 57 | properties.setProperty(PROPERTY_ZONE + ".Falkenberg." + ISO3166_CODES, "SE-N"); | 
| 58 | properties.setProperty(PROPERTY_ZONE + ".New York City." + ISO3166_CODES, "US-NY"); | 
| 59 | properties.setProperty(PROPERTY_ZONE + ".Stockholm." + ISO3166_CODES, "SE-AB"); | 
| 60 | properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[012].[01][04],os64Bit=true,minRam=768"); | 
| 61 | return properties; | 
| 62 | } | 
| 63 |  | 
| 64 | public static class Builder extends BaseProviderMetadata.Builder { | 
| 65 |  | 
| 66 | protected Builder() { | 
| 67 | id("glesys") | 
| 68 | .name("GleSYS") | 
| 69 | .apiMetadata(new GleSYSApiMetadata()) | 
| 70 | .homepage(URI.create("http://www.glesys.com")) | 
| 71 | .console(URI.create("https://customer.glesys.com/cloud.php")) | 
| 72 | .iso3166Codes("NL-NH","SE-N","US-NY","SE-AB") | 
| 73 | .endpoint("https://api.glesys.com") | 
| 74 | .defaultProperties(GleSYSProviderMetadata.defaultProperties()); | 
| 75 | } | 
| 76 |  | 
| 77 | @Override | 
| 78 | public GleSYSProviderMetadata build() { | 
| 79 | return new GleSYSProviderMetadata(this); | 
| 80 | } | 
| 81 |  | 
| 82 | @Override | 
| 83 | public Builder fromProviderMetadata(ProviderMetadata in) { | 
| 84 | super.fromProviderMetadata(in); | 
| 85 | return this; | 
| 86 | } | 
| 87 |  | 
| 88 | } | 
| 89 | } |