org.jclouds.compute.domain.TemplateBuilder Java Examples
The following examples show how to use
org.jclouds.compute.domain.TemplateBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T minRam(final int megabytes) { this.minRam = megabytes; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.minRam(megabytes); }}); return (T)this; }
Example #2
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T osArchMatches(final String osArchitectureRegex) { this.osArchitectureRegex = osArchitectureRegex; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.osArchMatches(osArchitectureRegex); }}); return (T)this; }
Example #3
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T os64Bit(final boolean is64bit) { this.is64bit = is64bit; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.os64Bit(is64bit); }}); return (T)this; }
Example #4
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T osFamily(final OsFamily os) { this.os = os; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.osFamily(os); }}); return (T)this; }
Example #5
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T hypervisorMatches(final String hypervisorRegex) { this.hypervisorRegex = hypervisorRegex; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.hypervisorMatches(hypervisorRegex); }}); return (T)this; }
Example #6
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T imageNameMatches(final String imageNameRegex) { this.imageNameRegex = imageNameRegex; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.imageNameMatches(imageNameRegex); }}); return (T)this; }
Example #7
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T imageDescriptionMatches(final String imageDescriptionRegex) { this.imageDescriptionRegex = imageDescriptionRegex; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.imageDescriptionMatches(imageDescriptionRegex); }}); return (T)this; }
Example #8
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T imageVersionMatches(final String imageVersionRegex) { this.imageVersionRegex = imageVersionRegex; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.imageVersionMatches(imageVersionRegex); }}); return (T)this; }
Example #9
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T imageMatches(final Predicate<Image> condition) { this.imageCondition = condition; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.imageMatches(condition); }}); return (T)this; }
Example #10
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T osVersionMatches(final String osVersionRegex) { this.osVersionRegex = osVersionRegex; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.osVersionMatches(osVersionRegex); }}); return (T)this; }
Example #11
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T minDisk(final double gigabytes) { this.minDisk = gigabytes; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.minDisk(gigabytes); }}); return (T)this; }
Example #12
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T imageChooser(final Function<Iterable<? extends Image>, Image> imageChooserFunction) { this.imageChooserFunction = imageChooserFunction; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.imageChooser(imageChooserFunction); }}); return (T)this; }
Example #13
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
/** adds customization options; if options have already been set, this will additively set selected options * (but not all, see addTemplateOptions for more info) */ public T addOptions(final TemplateOptions options) { this.additionalOptions.add(options); commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.options(options); }}); return (T)this; }
Example #14
Source File: PortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
public TemplateBuilder newJcloudsTemplateBuilder(ComputeService svc) { TemplateBuilder tb = svc.templateBuilder(); for (Function<TemplateBuilder,TemplateBuilder> c: commands) { tb = c.apply(tb); } tb.options(computeAggregatedOptions(true)); return tb; }
Example #15
Source File: PortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public TemplateBuilder from(TemplateBuilderSpec spec) { TemplateOptions options = new TemplateOptions(); addOptionalOptions(options); TemplateBuilder result = spec.copyTo(this, options); return result; }
Example #16
Source File: TemplateBuilderCustomizers.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public void apply(TemplateBuilder tb, ConfigBag props, Object v) { Maybe<OsFamily> osFamily = Enums.valueOfIgnoreCase(OsFamily.class, v.toString()); if (osFamily.isAbsent()) { throw new IllegalArgumentException("Invalid " + JcloudsLocationConfig.OS_FAMILY + " value " + v); } tb.osFamily(osFamily.get()); }
Example #17
Source File: JcloudsStubTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
public TemplateBuilder createTemplateBuilder() { final Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet.of(getImage())); ImmutableMap<RegionAndName, Image> imageMap = (ImmutableMap<RegionAndName, Image>) ImagesToRegionAndIdMap.imagesToMap(images.get()); Supplier<LoadingCache<RegionAndName, ? extends Image>> imageCache = Suppliers.<LoadingCache<RegionAndName, ? extends Image>> ofInstance( CacheBuilder.newBuilder().<RegionAndName, Image>build(CacheLoader.from(Functions.forMap(imageMap)))); return newTemplateBuilder(images, imageCache); }
Example #18
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T osDescriptionMatches(final String osDescriptionRegex) { this.osDescriptionRegex = osDescriptionRegex; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.osDescriptionMatches(osDescriptionRegex); }}); return (T)this; }
Example #19
Source File: TemplateBuilderCustomizers.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public void apply(TemplateBuilder tb, ConfigBag props, Object v) { Boolean os64Bit = TypeCoercions.coerce(v, Boolean.class); if (os64Bit != null) { tb.os64Bit(os64Bit); } }
Example #20
Source File: LocationCustomizerDelegate.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public void customize(JcloudsLocation location, ComputeService computeService, TemplateBuilder templateBuilder) { // Then apply any optional app-specific customization. for (JcloudsLocationCustomizer customizer : customizers) { customizer.customize(location, computeService, templateBuilder); } }
Example #21
Source File: AWSEC2ComputeService.java From attic-stratos with Apache License 2.0 | 5 votes |
@Inject protected AWSEC2ComputeService(ComputeServiceContext context, Map<String, Credentials> credentialStore, @Memoized Supplier<Set<? extends Image>> images, @Memoized Supplier<Set<? extends Hardware>> sizes, @Memoized Supplier<Set<? extends Location>> locations, ListNodesStrategy listNodesStrategy, GetImageStrategy getImageStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy, CreateNodesInGroupThenAddToSet runNodesAndAddToSetStrategy, RebootNodeStrategy rebootNodeStrategy, DestroyNodeStrategy destroyNodeStrategy, ResumeNodeStrategy startNodeStrategy, SuspendNodeStrategy stopNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider, @Named("DEFAULT") Provider<TemplateOptions> templateOptionsProvider, @Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning, @Named(TIMEOUT_NODE_TERMINATED) Predicate<AtomicReference<NodeMetadata>> nodeTerminated, @Named(TIMEOUT_NODE_SUSPENDED) Predicate<AtomicReference<NodeMetadata>> nodeSuspended, InitializeRunScriptOnNodeOrPlaceInBadMap.Factory initScriptRunnerFactory, RunScriptOnNode.Factory runScriptOnNodeFactory, InitAdminAccess initAdminAccess, PersistNodeCredentials persistNodeCredentials, Timeouts timeouts, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, AWSEC2Api client, ConcurrentMap<RegionAndName, KeyPair> credentialsMap, @Named("SECURITY") LoadingCache<RegionAndName, String> securityGroupMap, @Named("PLACEMENT") LoadingCache<RegionAndName, String> placementGroupMap, @Named("DELETED") Predicate<PlacementGroup> placementGroupDeleted, Optional<ImageExtension> imageExtension, GroupNamingConvention.Factory namingConvention, @Named(PROPERTY_EC2_GENERATE_INSTANCE_NAMES) boolean generateInstanceNames, Optional<SecurityGroupExtension> securityGroupExtension) { super(context, credentialStore, images, sizes, locations, listNodesStrategy, getImageStrategy, getNodeMetadataStrategy, runNodesAndAddToSetStrategy, rebootNodeStrategy, destroyNodeStrategy, startNodeStrategy, stopNodeStrategy, templateBuilderProvider, templateOptionsProvider, nodeRunning, nodeTerminated, nodeSuspended, initScriptRunnerFactory, runScriptOnNodeFactory, initAdminAccess, persistNodeCredentials, timeouts, userExecutor, client, credentialsMap, securityGroupMap, imageExtension, namingConvention, generateInstanceNames, securityGroupExtension); this.client = client; this.placementGroupMap = placementGroupMap; this.placementGroupDeleted = placementGroupDeleted; }
Example #22
Source File: AWSEC2ComputeServiceDependenciesModule.java From attic-stratos with Apache License 2.0 | 5 votes |
@Override protected void configure() { bind(TemplateBuilder.class).to(EC2TemplateBuilderImpl.class); bind(TemplateOptions.class).to(AWSEC2TemplateOptions.class); bind(ComputeService.class).to(AWSEC2ComputeService.class); bind(new TypeLiteral<CacheLoader<RunningInstance, Optional<LoginCredentials>>>() { }).to(CredentialsForInstance.class); bind(new TypeLiteral<CacheLoader<RegionAndName, String>>() { }).annotatedWith(Names.named("SECURITY")).to(AWSEC2CreateSecurityGroupIfNeeded.class); bind(new TypeLiteral<CacheLoader<RegionAndName, String>>() { }).annotatedWith(Names.named("ELASTICIP")).to(LoadPublicIpForInstanceOrNull.class); bind(new TypeLiteral<Function<String, String>>() { }).annotatedWith(Names.named("SECGROUP_NAME_TO_ID")).to(EC2SecurityGroupIdFromName.class); bind(new TypeLiteral<Function<PasswordDataAndPrivateKey, LoginCredentials>>() { }).to(WindowsLoginCredentialsFromEncryptedData.class); bind(new TypeLiteral<Function<RunningInstance, LoginCredentials>>() { }).to(PasswordCredentialsFromWindowsInstance.class); bind(new TypeLiteral<Function<RegionAndName, KeyPair>>() { }).to(CreateUniqueKeyPair.class); bind(new TypeLiteral<Function<RegionNameAndPublicKeyMaterial, KeyPair>>() { }).to(ImportOrReturnExistingKeypair.class); bind(new TypeLiteral<CacheLoader<RegionAndName, Image>>() { }).to(RegionAndIdToImage.class); install(new FactoryModuleBuilder().build(CallForImages.Factory.class)); bind(new TypeLiteral<Function<org.jclouds.ec2.domain.Image, Image>>() { }).to(EC2ImageParser.class); bind(new TypeLiteral<Function<org.jclouds.ec2.domain.SecurityGroup, SecurityGroup>>() { }).to(AWSEC2SecurityGroupToSecurityGroup.class); bind(new TypeLiteral<ImageExtension>() { }).to(EC2ImageExtension.class); bind(new TypeLiteral<SecurityGroupExtension>() { }).to(AWSEC2SecurityGroupExtension.class); }
Example #23
Source File: AbstractEbsVolumeCustomizer.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public void customize(JcloudsLocation location, ComputeService computeService, TemplateBuilder templateBuilder) { if (computeService instanceof AWSEC2ComputeService) { templateBuilder.locationId(availabilityZone); } else { LOG.debug("Skipping configuration of non-EC2 ComputeService {}", computeService); } }
Example #24
Source File: AWSEC2TemplateBuilderImpl.java From attic-stratos with Apache License 2.0 | 5 votes |
@Inject protected AWSEC2TemplateBuilderImpl(@Memoized Supplier<Set<? extends Location>> locations, ImageCacheSupplier images, @Memoized Supplier<Set<? extends Hardware>> sizes, Supplier<Location> defaultLocation, @Named("DEFAULT") Provider<TemplateOptions> optionsProvider, @Named("DEFAULT") Provider<TemplateBuilder> defaultTemplateProvider, GetImageStrategy getImageStrategy, Supplier<LoadingCache<RegionAndName, ? extends Image>> imageMap) { super(locations, images, sizes, defaultLocation, optionsProvider, defaultTemplateProvider, getImageStrategy, imageMap); }
Example #25
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T any() { commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.any(); }}); return (T)this; }
Example #26
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T fromHardware(final Hardware hardware) { this.hardware = hardware; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.fromHardware(hardware); }}); return (T)this; }
Example #27
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T fromImage(final Image image) { this.image = image; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.fromImage(image); }}); return (T)this; }
Example #28
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T fromTemplate(final Template template) { this.template = template; commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.fromTemplate(template); }}); return (T)this; }
Example #29
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T smallest() { commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.smallest(); }}); return (T)this; }
Example #30
Source File: AbstractPortableTemplateBuilder.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public T fastest() { commands.add(new Function<TemplateBuilder,TemplateBuilder>() { @Override public TemplateBuilder apply(TemplateBuilder b) { return b.fastest(); }}); return (T)this; }