
org.jclouds.aws.ec2.AWSEC2ApiMetadata Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jclouds-shaded Show documentation
Show all versions of jclouds-shaded Show documentation
Provides a shaded jclouds with relocated guava and guice
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.aws.ec2;
import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
import java.net.URI;
import java.util.Properties;
import org.jclouds.Constants;
import org.jclouds.aws.ec2.compute.AWSEC2ComputeServiceContext;
import org.jclouds.aws.ec2.compute.config.AWSEC2ComputeServiceContextModule;
import org.jclouds.aws.ec2.config.AWSEC2HttpApiModule;
import org.jclouds.ec2.EC2ApiMetadata;
import org.jclouds.ec2.compute.config.EC2ResolveImagesModule;
import org.jclouds.rest.internal.BaseHttpApiMetadata;
import shaded.com.google.common.collect.ImmutableSet;
import shaded.com.google.inject.Module;
public final class AWSEC2ApiMetadata extends BaseHttpApiMetadata {
@Override
public Builder toBuilder() {
return new Builder().fromApiMetadata(this);
}
public AWSEC2ApiMetadata() {
super(new Builder());
}
protected AWSEC2ApiMetadata(Builder builder) {
super(builder);
}
public static Properties defaultProperties() {
Properties properties = EC2ApiMetadata.defaultProperties();
properties.remove(PROPERTY_EC2_AMI_OWNERS);
// auth fail sometimes happens in EC2, as the rc.local script that injects the
// authorized key executes after ssh has started.
properties.setProperty("jclouds.ssh.max-retries", "7");
properties.setProperty("jclouds.ssh.retry-auth", "true");
// required for custom retry handler
properties.setProperty(Constants.PROPERTY_IDEMPOTENT_METHODS, "DELETE,GET,HEAD,OPTIONS,PUT,POST");
return properties;
}
public static final class Builder extends BaseHttpApiMetadata.Builder {
public Builder() {
id("aws-ec2")
.version("2012-06-01")
.name("Amazon-specific EC2 API")
.identityName("Access Key ID")
.credentialName("Secret Access Key")
.defaultEndpoint("https://ec2.us-east-1.amazonaws.com")
.documentation(URI.create("http://docs.amazonwebservices.com/AWSEC2/latest/APIReference"))
.defaultProperties(AWSEC2ApiMetadata.defaultProperties())
.view(AWSEC2ComputeServiceContext.class)
.defaultModules(ImmutableSet.>of(AWSEC2HttpApiModule.class, EC2ResolveImagesModule.class, AWSEC2ComputeServiceContextModule.class));
}
@Override
public AWSEC2ApiMetadata build() {
return new AWSEC2ApiMetadata(this);
}
@Override
protected Builder self() {
return this;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy