All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.elastisys.scale.cloudpool.aws.commons.functions.AwsAutoScalingFunctions Maven / Gradle / Ivy

There is a newer version: 5.2.3
Show newest version
package com.elastisys.scale.cloudpool.aws.commons.functions;

import com.amazonaws.services.autoscaling.model.Instance;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;

/**
 * A factory class for {@link Function}s relating to the Amazon Auto Scaling
 * API.
 *
 * 
 *
 */
public class AwsAutoScalingFunctions {

	/**
	 * Returns a {@link Function} that for a given Auto Scaling {@link Instance}
	 * input returns its identity.
	 *
	 * @return
	 */
	public static Function toAutoScalingInstanceId() {
		return new ToAutoScalingInstanceId();
	}

	/**
	 * A {@link Function} that for a given Auto Scaling {@link Instance} input
	 * returns the name of its identifier.
	 *
	 * 
	 */
	public static class ToAutoScalingInstanceId implements
			Function {
		@Override
		public String apply(Instance instance) {
			Preconditions.checkNotNull(instance, "null instance");
			return instance.getInstanceId();
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy