public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation implements JcloudsLocationConfig, MachineManagementMixins.RichMachineProvisioningLocation<MachineLocation>, LocationWithObjectStore
JcloudsLocationConfig
.Modifier and Type | Class and Description |
---|---|
static interface |
JcloudsLocation.CustomizeTemplateOptions |
BrooklynObject.TagSupport
Configurable.ConfigurationSupport
BrooklynObjectInternal.ConfigurationSupportInternal
Modifier and Type | Field and Description |
---|---|
static java.util.List<java.lang.String> |
COMMON_USER_NAMES_TO_TRY |
static org.slf4j.Logger |
LOG |
static java.util.List<java.lang.String> |
ROOT_ALIASES
these userNames are known to be the preferred/required logins in some common/default images
where root@ is not allowed to log in
|
static java.lang.String |
ROOT_USERNAME |
static java.util.Map<ConfigKey<?>,brooklyn.location.jclouds.JcloudsLocation.CustomizeTemplateBuilder> |
SUPPORTED_TEMPLATE_BUILDER_PROPERTIES
properties which cause customization of the TemplateBuilder
|
static java.util.Map<ConfigKey<?>,JcloudsLocation.CustomizeTemplateOptions> |
SUPPORTED_TEMPLATE_OPTIONS_PROPERTIES
properties which cause customization of the TemplateOptions
|
PARENT_LOCATION, TEMPORARY_LOCATION
AUTO_ASSIGN_FLOATING_IP, AUTO_CREATE_FLOATING_IPS, AUTO_GENERATE_KEYPAIRS, CLOUD_PROVIDER, COMPUTE_SERVICE_REGISTRY, CUSTOM_CREDENTIALS, CUSTOM_MACHINE_SETUP_SCRIPT_URL, CUSTOM_MACHINE_SETUP_SCRIPT_URL_LIST, CUSTOM_MACHINE_SETUP_SCRIPT_VARS, CUSTOM_TEMPLATE_OPTIONS_SCRIPT_CONTENTS, DEFAULT_IMAGE_ID, DISABLE_ROOT_AND_PASSWORD_SSH, DONT_CREATE_USER, EXTRA_PUBLIC_KEY_DATA_TO_AUTH, EXTRA_PUBLIC_KEY_URLS_TO_AUTH, GENERATE_HOSTNAME, GRANT_USER_SUDO, GROUP_ID, HARDWARE_ID, IMAGE_CHOOSER, IMAGE_DESCRIPTION_REGEX, IMAGE_ID, IMAGE_NAME_REGEX, INCLUDE_BROOKLYN_USER_METADATA, JCLOUDS_KEY_ENDPOINT, JCLOUDS_KEY_USERNAME, JCLOUDS_LOCATION_CUSTOMIZER, JCLOUDS_LOCATION_CUSTOMIZER_TYPE, JCLOUDS_LOCATION_CUSTOMIZERS, JCLOUDS_LOCATION_CUSTOMIZERS_SUPPLIER_TYPE, KEY_PAIR, LOCAL_TEMP_DIR, LOGIN_USER, LOGIN_USER_PASSWORD, LOGIN_USER_PRIVATE_KEY_DATA, LOGIN_USER_PRIVATE_KEY_FILE, MACHINE_CREATE_ATTEMPTS, MACHINE_CREATION_SEMAPHORE, MAP_DEV_RANDOM_TO_DEV_URANDOM, MAX_CONCURRENT_MACHINE_CREATIONS, NETWORK_NAME, OPEN_IPTABLES, OS_FAMILY, OS_FAMILY_OVERRIDE, OS_VERSION_REGEX, OVERRIDE_RAM, PORT_FORWARDER, PORT_FORWARDING_MANAGER, RUN_AS_ROOT, SECURITY_GROUPS, STOP_IPTABLES, STRING_TAGS, TAGS, TEMPLATE_BUILDER, TEMPLATE_OPTIONS, TEMPLATE_SPEC, USE_JCLOUDS_SSH_INIT, USE_PORT_FORWARDING, USER_DATA_UUENCODED, USER_METADATA, USER_METADATA_MAP, USER_METADATA_STRING
ACCESS_CREDENTIAL, ACCESS_IDENTITY, ADDITIONAL_INBOUND_PORTS, CALLER_CONTEXT, CLOUD_AVAILABILITY_ZONE_ID, CLOUD_ENDPOINT, CLOUD_REGION_ID, DESTROY_ON_FAILURE, DOMAIN_NAME, INBOUND_PORTS, LEGACY_PRIVATE_KEY_DATA, LEGACY_PRIVATE_KEY_FILE, LEGACY_PRIVATE_KEY_PASSPHRASE, LEGACY_PUBLIC_KEY_DATA, LEGACY_PUBLIC_KEY_FILE, LOG_CREDENTIALS, MIN_CORES, MIN_DISK, MIN_RAM, OS_64_BIT, PASSWORD, PRIVATE_KEY_DATA, PRIVATE_KEY_FILE, PRIVATE_KEY_PASSPHRASE, PUBLIC_KEY_DATA, PUBLIC_KEY_FILE, USER, VM_NAME_MAX_LENGTH, VM_NAME_SALT_LENGTH, WAIT_FOR_SSHABLE, WAIT_FOR_WINRM_AVAILABLE
FINAL_SPEC, NAMED_SPEC_NAME, ORIGINAL_SPEC
Constructor and Description |
---|
JcloudsLocation() |
JcloudsLocation(java.util.Map<?,?> conf)
typically wants at least ACCESS_IDENTITY and ACCESS_CREDENTIAL
|
Modifier and Type | Method and Description |
---|---|
static java.io.File |
asFile(java.lang.Object o) |
org.jclouds.compute.domain.Template |
buildTemplate(org.jclouds.compute.ComputeService computeService,
ConfigBag config)
returns the jclouds Template which describes the image to be built, for the given config and compute service
|
JcloudsLocation |
configure(java.util.Map<?,?> properties)
Will set fields from flags, and put the remaining ones into the 'leftovers' map.
|
static java.lang.String |
fileAsString(java.lang.Object o) |
static java.util.Set<ConfigKey<?>> |
getAllSupportedProperties() |
org.jclouds.compute.ComputeService |
getComputeService() |
org.jclouds.compute.ComputeService |
getComputeService(java.util.Map<?,?> flags) |
java.lang.String |
getCredential() |
java.lang.String |
getEndpoint() |
java.lang.String |
getIdentity() |
MachineManagementMixins.MachineMetadata |
getMachineMetadata(MachineLocation l)
returns the MachineMetadata for a given (brooklyn) machine location instance,
or null if not matched
|
java.lang.String |
getProvider() |
java.util.Map<java.lang.String,java.lang.Object> |
getProvisioningFlags(java.util.Collection<java.lang.String> tags)
Gets flags, suitable as an argument to
MachineProvisioningLocation.obtain(Map) . |
java.lang.String |
getRegion()
returns the location ID used by the provider, if set, e.g.
|
java.lang.String |
getUser(ConfigBag config) |
void |
init()
Called by framework (in new-style instances where spec was used) after configuring etc,
but before a reference to this instance is shared.
|
boolean |
isLocationFirewalldEnabled(SshMachineLocation location) |
boolean |
isWindows(org.jclouds.compute.domain.Image image,
ConfigBag config)
Whether VMs provisioned from this image will be Windows.
|
boolean |
isWindows(org.jclouds.compute.domain.NodeMetadata node,
ConfigBag config)
Whether the given VM is Windows.
|
boolean |
isWindows(org.jclouds.compute.domain.Template template,
ConfigBag config) |
void |
killMachine(MachineLocation l)
Kills the indicated machine; throws if not recognised or possible
|
void |
killMachine(java.lang.String cloudServiceId)
Kills the machine indicated by the given (server-side) machine id;
note, the ID is the _cloud-service_ ID,
that is, pass in getMetadata(machineLocation).getId() not the machineLocation.getId()
|
java.util.Map<java.lang.String,MachineManagementMixins.MachineMetadata> |
listMachines()
returns map of machine ID to metadata record for all machines known in a given cloud location
|
java.util.Set<? extends org.jclouds.compute.domain.ComputeMetadata> |
listNodes()
Deprecated.
since 0.7.0 use
listMachines() |
java.util.Set<? extends org.jclouds.compute.domain.ComputeMetadata> |
listNodes(java.util.Map<?,?> flags)
Deprecated.
since 0.7.0 use
listMachines() .
(no support for custom compute service flags; if that is needed, we'll have to introduce a new method,
but it seems there are no usages) |
PersistenceObjectStore |
newPersistenceObjectStore(java.lang.String container)
Creates a
PersistenceObjectStore pointed at the given container/directory. |
JcloudsLocation |
newSubLocation(java.lang.Class<? extends AbstractCloudMachineProvisioningLocation> type,
java.util.Map<?,?> newFlags) |
JcloudsLocation |
newSubLocation(java.util.Map<?,?> newFlags)
uses reflection to create an object of the same type, assuming a Map constructor;
subclasses can extend and downcast the result
|
MachineLocation |
obtain() |
MachineLocation |
obtain(java.util.Map<?,?> flags)
core method for obtaining a VM using jclouds;
Map should contain CLOUD_PROVIDER and CLOUD_ENDPOINT or CLOUD_REGION, depending on the cloud,
as well as ACCESS_IDENTITY and ACCESS_CREDENTIAL,
plus any further properties to specify e.g.
|
MachineLocation |
obtain(java.util.Map<?,?> flags,
org.jclouds.compute.domain.TemplateBuilder tb) |
MachineLocation |
obtain(org.jclouds.compute.domain.TemplateBuilder tb) |
JcloudsSshMachineLocation |
rebindMachine(ConfigBag setup)
Brings an existing machine with the given details under management.
|
JcloudsSshMachineLocation |
rebindMachine(java.util.Map<?,?> flags) |
JcloudsSshMachineLocation |
rebindMachine(java.util.Map<?,?> flags,
org.jclouds.compute.domain.NodeMetadata metadata) |
JcloudsSshMachineLocation |
rebindMachine(org.jclouds.compute.domain.NodeMetadata metadata) |
void |
release(MachineLocation rawMachine)
Release a previously-obtained machine.
|
void |
setDefaultImageId(java.lang.String val) |
void |
setTagMapping(java.util.Map<java.lang.String,java.util.Map<java.lang.String,? extends java.lang.Object>> val) |
java.lang.String |
toString()
Default String representation is simplified name of class, together with selected fields.
|
java.lang.String |
toVerboseString() |
addChild, addExtension, config, containsLocation, equals, getAllConfig, getAllConfigBag, getChildren, getConfig, getConfig, getDisplayName, getExtension, getHostGeoInfo, getLocalConfigBag, getParent, getRawLocalConfigBag, getRebindSupport, hasConfig, hasExtension, hashCode, isManaged, onManagementStarted, onManagementStopped, removeChild, setConfig, setDisplayName, setHostGeoInfo, setManagementContext, setName, setParent, setParent, toMetadataRecord
getCatalogItemId, getId, getManagementContext, getTagSupport, rebind, setCatalogItemId, tags
containsLocation, getAllConfig, getChildren, getConfig, getConfig, getDisplayName, getExtension, getId, getParent, hasConfig, hasExtension, setParent
getCatalogItemId, getTagSupport, tags
config, setConfig
getManagementContext
setCatalogItemId
public static final org.slf4j.Logger LOG
public static final java.lang.String ROOT_USERNAME
public static final java.util.List<java.lang.String> ROOT_ALIASES
public static final java.util.List<java.lang.String> COMMON_USER_NAMES_TO_TRY
public static final java.util.Map<ConfigKey<?>,brooklyn.location.jclouds.JcloudsLocation.CustomizeTemplateBuilder> SUPPORTED_TEMPLATE_BUILDER_PROPERTIES
public static final java.util.Map<ConfigKey<?>,JcloudsLocation.CustomizeTemplateOptions> SUPPORTED_TEMPLATE_OPTIONS_PROPERTIES
public JcloudsLocation()
public JcloudsLocation(java.util.Map<?,?> conf)
public JcloudsLocation configure(java.util.Map<?,?> properties)
AbstractBrooklynObject
ConfigBag.getUnusedConfig()
.
To be overridden by AbstractEntity, AbstractLoation, AbstractPolicy, AbstractEnricher, etc.
But should not be overridden by specific entity types. If you do, the entity may break in subsequent releases. Also note that if you require fields to be initialized you must do that in this method. You must *not* rely on field initializers because they may not run until *after* this method (this method is invoked by the constructor in this class, so initializers in subclasses will not have run when this overridden method is invoked.)
configure
in class AbstractLocation
public void init()
AbstractBrooklynObject
To preserve backwards compatibility for if the instance is constructed directly, one can call the code below, but that means it will be called after references to this policy have been shared with other entities.
if (isLegacyConstruction()) {
init();
}
init
in class AbstractBrooklynObject
public JcloudsLocation newSubLocation(java.util.Map<?,?> newFlags)
AbstractCloudMachineProvisioningLocation
newSubLocation
in interface MachineProvisioningLocation<MachineLocation>
newSubLocation
in class AbstractCloudMachineProvisioningLocation
public JcloudsLocation newSubLocation(java.lang.Class<? extends AbstractCloudMachineProvisioningLocation> type, java.util.Map<?,?> newFlags)
newSubLocation
in class AbstractCloudMachineProvisioningLocation
public java.lang.String toString()
AbstractLocation
toString
in class AbstractLocation
public java.lang.String toVerboseString()
toVerboseString
in interface Location
toVerboseString
in class AbstractLocation
public java.lang.String getProvider()
public java.lang.String getIdentity()
public java.lang.String getCredential()
public java.lang.String getRegion()
public java.lang.String getEndpoint()
public java.lang.String getUser(ConfigBag config)
public boolean isWindows(org.jclouds.compute.domain.Template template, ConfigBag config)
public boolean isWindows(org.jclouds.compute.domain.Image image, ConfigBag config)
JcloudsLocationConfig.OS_FAMILY
.
Will first look at JcloudsLocationConfig.OS_FAMILY_OVERRIDE
, to check if that
is set. If so, no further checks are done: the value is compared against OsFamily.WINDOWS
.
We believe the config (e.g. from brooklyn.properties) because for some clouds there is
insufficient meta-data so the Image might not tell us. Thus a user can work around it
by explicitly supplying configuration.public boolean isWindows(org.jclouds.compute.domain.NodeMetadata node, ConfigBag config)
#isWindows(Image, ConfigBag)}
public boolean isLocationFirewalldEnabled(SshMachineLocation location)
public void setDefaultImageId(java.lang.String val)
public void setTagMapping(java.util.Map<java.lang.String,java.util.Map<java.lang.String,? extends java.lang.Object>> val)
public java.util.Map<java.lang.String,java.lang.Object> getProvisioningFlags(java.util.Collection<java.lang.String> tags)
MachineProvisioningLocation
MachineProvisioningLocation.obtain(Map)
. The tags provided give
hints about the machine required. The provisioning-location could be configured to
understand those tags.
For example, an AWS-location could be configured to understand that a particular entity
type (e.g. "TomcatServer") requires a particular AMI in that region, so would return the
required image id.getProvisioningFlags
in interface MachineProvisioningLocation<MachineLocation>
getProvisioningFlags
in class AbstractCloudMachineProvisioningLocation
public static final java.util.Set<ConfigKey<?>> getAllSupportedProperties()
public org.jclouds.compute.ComputeService getComputeService()
public org.jclouds.compute.ComputeService getComputeService(java.util.Map<?,?> flags)
@Deprecated public java.util.Set<? extends org.jclouds.compute.domain.ComputeMetadata> listNodes()
listMachines()
@Deprecated public java.util.Set<? extends org.jclouds.compute.domain.ComputeMetadata> listNodes(java.util.Map<?,?> flags)
listMachines()
.
(no support for custom compute service flags; if that is needed, we'll have to introduce a new method,
but it seems there are no usages)public java.util.Map<java.lang.String,MachineManagementMixins.MachineMetadata> listMachines()
MachineManagementMixins.ListsMachines
listMachines
in interface MachineManagementMixins.ListsMachines
public MachineManagementMixins.MachineMetadata getMachineMetadata(MachineLocation l)
MachineManagementMixins.GivesMachineMetadata
getMachineMetadata
in interface MachineManagementMixins.GivesMachineMetadata
public void killMachine(java.lang.String cloudServiceId)
MachineManagementMixins.KillsMachines
killMachine
in interface MachineManagementMixins.KillsMachines
public void killMachine(MachineLocation l)
MachineManagementMixins.KillsMachines
killMachine
in interface MachineManagementMixins.KillsMachines
public MachineLocation obtain() throws NoMachinesAvailableException
NoMachinesAvailableException
public MachineLocation obtain(org.jclouds.compute.domain.TemplateBuilder tb) throws NoMachinesAvailableException
NoMachinesAvailableException
public MachineLocation obtain(java.util.Map<?,?> flags, org.jclouds.compute.domain.TemplateBuilder tb) throws NoMachinesAvailableException
NoMachinesAvailableException
public MachineLocation obtain(java.util.Map<?,?> flags) throws NoMachinesAvailableException
obtain
in interface MachineProvisioningLocation<MachineLocation>
obtain
in interface ProvisioningLocation<MachineLocation>
flags
- Details of the desired machine (e.g. image, size, open ports, etc; some flag support is limited to selected providers).
"callerContext" can be specified to have custom logging and error messages (useful if starting machines in parallel)NoMachinesAvailableException
- if there are no machines available in this location (or impls may return null, but that is discouraged)public org.jclouds.compute.domain.Template buildTemplate(org.jclouds.compute.ComputeService computeService, ConfigBag config)
public JcloudsSshMachineLocation rebindMachine(org.jclouds.compute.domain.NodeMetadata metadata) throws NoMachinesAvailableException
NoMachinesAvailableException
public JcloudsSshMachineLocation rebindMachine(java.util.Map<?,?> flags, org.jclouds.compute.domain.NodeMetadata metadata) throws NoMachinesAvailableException
NoMachinesAvailableException
public JcloudsSshMachineLocation rebindMachine(ConfigBag setup) throws NoMachinesAvailableException
Required fields are:
NoMachinesAvailableException
public JcloudsSshMachineLocation rebindMachine(java.util.Map<?,?> flags) throws NoMachinesAvailableException
NoMachinesAvailableException
public void release(MachineLocation rawMachine)
MachineProvisioningLocation
release
in interface MachineProvisioningLocation<MachineLocation>
release
in interface ProvisioningLocation<MachineLocation>
rawMachine
- a MachineLocation
previously obtained from a call to #obtain()
public static java.io.File asFile(java.lang.Object o)
public static java.lang.String fileAsString(java.lang.Object o)
public PersistenceObjectStore newPersistenceObjectStore(java.lang.String container)
LocationWithObjectStore
PersistenceObjectStore
pointed at the given container/directory.newPersistenceObjectStore
in interface LocationWithObjectStore