本文整理汇总了Java中com.amazonaws.services.route53.AmazonRoute53类的典型用法代码示例。如果您正苦于以下问题:Java AmazonRoute53类的具体用法?Java AmazonRoute53怎么用?Java AmazonRoute53使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AmazonRoute53类属于com.amazonaws.services.route53包,在下文中一共展示了AmazonRoute53类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.amazonaws.services.route53.AmazonRoute53; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
Arguments arguments = new Arguments();
CmdLineParser parser = new CmdLineParser(arguments);
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
System.err.println("Usage: java -jar dyndns.jar <arguments>");
parser.printUsage(System.err);
System.exit(1);
}
AmazonRoute53 route53 = new AmazonRoute53Client(new DefaultAWSCredentialsProviderChain());
UpdateDns updateDns = new UpdateDns(route53, arguments.hostedZoneId);
updateDns.updateDns(arguments.recordSetName, arguments.force);
}
示例2: attachDomainToEip
import com.amazonaws.services.route53.AmazonRoute53; //导入依赖的package包/类
public static ChangeInfo attachDomainToEip(AmazonRoute53 route53, String publicIp, String domain) {
String hostedZoneId = findHostedZoneForDomain(route53, domain);
if (hostedZoneId != null) {
System.out.println("Found HostedZone's Id(" + hostedZoneId + ")");
} else {
return null;
}
ResourceRecordSet resourceRecordSet = generateResourceRecordSetForARecord(publicIp, domain);
ChangeInfo changeinfo = AwsRoute53Client.changeResourceRecordSet(route53, hostedZoneId, resourceRecordSet,
ChangeAction.CREATE);
return changeinfo;
}
示例3: findHostedZoneForDomain
import com.amazonaws.services.route53.AmazonRoute53; //导入依赖的package包/类
public static String findHostedZoneForDomain(AmazonRoute53 route53, String domain) {
ListHostedZonesResult listHostedZonesResult = route53.listHostedZones();
List<HostedZone> hostedZones = listHostedZonesResult.getHostedZones();
String hostedZoneId = null;
for (HostedZone hostedZone : hostedZones) {
if (isRootDomain(domain, hostedZone)) {
hostedZoneId = hostedZone.getId();
break;
}
}
return hostedZoneId;
}
示例4: changeResourceRecordSet
import com.amazonaws.services.route53.AmazonRoute53; //导入依赖的package包/类
public static ChangeInfo changeResourceRecordSet(AmazonRoute53 route53, String hostedZoneId,
ResourceRecordSet resourceRecordSet, ChangeAction changeAction) {
Change change = new Change(changeAction, resourceRecordSet);
ChangeBatch changeBatch = new ChangeBatch().withChanges(change);
ChangeResourceRecordSetsRequest changeResourceRecordSetsRequest = new ChangeResourceRecordSetsRequest(
hostedZoneId, changeBatch);
ChangeResourceRecordSetsResult changeResourceRecordSetsResult = route53
.changeResourceRecordSets(changeResourceRecordSetsRequest);
ChangeInfo changeinfo = changeResourceRecordSetsResult.getChangeInfo();
return changeinfo;
}
示例5: getAmazonRoute53Client
import com.amazonaws.services.route53.AmazonRoute53; //导入依赖的package包/类
@Override
public AmazonRoute53 getAmazonRoute53Client() {
return r53;
}
示例6: getRoute53
import com.amazonaws.services.route53.AmazonRoute53; //导入依赖的package包/类
public static AmazonRoute53 getRoute53() {
AmazonRoute53 route53 = new AmazonRoute53Client(ConfigProvider.getCredential());
route53.setRegion(ConfigProvider.getDefaultRegion());
return route53;
}
示例7: startByName
import com.amazonaws.services.route53.AmazonRoute53; //导入依赖的package包/类
private int startByName(Ec2CommandOptions options) throws FileNotFoundException {
String name = options.getName();
InputStream inputStream = new FileInputStream(new File(options.getCredentialsPath()));
ConfigProvider.loadConfigure(inputStream);
AmazonEC2 ec2 = AwsEc2Client.getEc2();
// Check Exists Instance
Instance instance = AwsEc2Client.findInstanceByName(ec2, name);
if (instance == null) {
System.err.println("Not exists instance (name = " + name + ").");
return 2;
}
String instanceId = instance.getInstanceId();
System.out.println("Exists instance (id = " + instanceId + ")");
// Start Ec2 Instance
InstanceStateChange stateChange = AwsEc2Client.startInstance(ec2, instanceId);
AwsEc2Client.showStateChange(stateChange, "Starting Instance");
// Allocate Address
DomainType domainType = (instance.getVpcId() == null) ? DomainType.Standard : DomainType.Vpc;
Address address = AwsEc2Client.allocateAddress(ec2, domainType);
String publicIp = address.getPublicIp();
System.out.println("Allocated Address(" + publicIp + ", " + address.getAllocationId() + ")");
if (address != null) {
// TODO: Wait for Starting Instance.
waitForStartingInstance();
try {
// Associate Address
String associateAddress = AwsEc2Client.associateAddress(ec2, address, instanceId);
System.out.println("Associated Address(" + publicIp + ", " + associateAddress + ")");
String domain = options.getDomain();
if (domain != null) {
// Attach Domain to EIP
AmazonRoute53 route53 = AwsRoute53Client.getRoute53();
ChangeInfo attachedResult = AwsRoute53Client.attachDomainToEip(route53, publicIp, domain);
if (attachedResult != null) {
System.out.println("Attached domain(" + domain + ")");
} else {
System.err.println("Not Found Available Hosted Zone for specified Domain(" + domain + ")");
}
}
} catch (AmazonServiceException e) {
AwsEc2Client.releaseAddress(ec2, address);
System.out.println("Released Address (" + publicIp + ")");
return 2;
}
}
return 0;
}
示例8: getAmazonClient
import com.amazonaws.services.route53.AmazonRoute53; //导入依赖的package包/类
@Override
public AmazonRoute53 getAmazonClient() {
return r53;
}
示例9: UpdateDns
import com.amazonaws.services.route53.AmazonRoute53; //导入依赖的package包/类
public UpdateDns(AmazonRoute53 route53, String hostedZoneId) {
this.route53 = route53;
this.hostedZoneId = hostedZoneId;
}
示例10: newClient
import com.amazonaws.services.route53.AmazonRoute53; //导入依赖的package包/类
private AmazonRoute53 newClient() {
final AmazonRoute53 amazonClient = new AmazonRoute53Client(credentials);
return amazonClient;
}
示例11: getAmazonRoute53Client
import com.amazonaws.services.route53.AmazonRoute53; //导入依赖的package包/类
/**
*
* @return
*/
AmazonRoute53 getAmazonRoute53Client();
示例12: getAmazonClient
import com.amazonaws.services.route53.AmazonRoute53; //导入依赖的package包/类
/**
*
* @return The amazon client
*/
AmazonRoute53 getAmazonClient();