@Override public TypeToken<?> getBackendType() { return delegate().getBackendType(); }
@Override public TypeToken<?> getBackendType() { return delegate().getBackendType(); }
/** * If this is an EBS-backed volume, map the ephemeral device. */ private static Template mapEphemeralIfImageIsEBSBacked(ComputeServiceContext context, ClusterSpec spec, Template template, InstanceTemplate instanceTemplate) { if (EC2ApiMetadata.CONTEXT_TOKEN.isAssignableFrom(context.getBackendType())) { if (EC2ImagePredicates.rootDeviceType(EBS).apply(template.getImage())) { template.getOptions().as(EC2TemplateOptions.class).mapEphemeralDeviceToDeviceName("/dev/sdc", "ephemeral1"); } } return setPlacementGroup(context, spec, template, instanceTemplate); }
/** * Set the placement group, if desired - if it doesn't already exist, create it. */ private static Template setPlacementGroup(ComputeServiceContext context, ClusterSpec spec, Template template, InstanceTemplate instanceTemplate) { if (AWSEC2ApiMetadata.CONTEXT_TOKEN.isAssignableFrom(context.getBackendType())) { if (spec.getAwsEc2PlacementGroup() != null) { template.getOptions().as(AWSEC2TemplateOptions.class).placementGroup(spec.getAwsEc2PlacementGroup()); } } return template; }
public static void authorizeIngress(ComputeServiceContext computeServiceContext, Set<Instance> instances, ClusterSpec clusterSpec, List<String> cidrs, int... ports) { if (EC2ApiMetadata.CONTEXT_TOKEN.isAssignableFrom(computeServiceContext.getBackendType())) { } else if (NovaApiMetadata.CONTEXT_TOKEN.isAssignableFrom(computeServiceContext.getBackendType())) {
when(serviceContext.getComputeService()).thenReturn(computeService); when(computeService.getContext()).thenReturn(serviceContext); when(serviceContext.getBackendType()).thenReturn(TypeToken.class.cast(TypeToken.of(Context.class))); when(computeService.templateBuilder()).thenReturn(templateBuilder); when(templateBuilder.from((TemplateBuilderSpec) any())).thenReturn(templateBuilder);
/** * Set maximum spot instance price based on the configuration */ private static Template setSpotInstancePriceIfSpecified( ComputeServiceContext context, ClusterSpec spec, Template template, InstanceTemplate instanceTemplate ) { if (AWSEC2ApiMetadata.CONTEXT_TOKEN.isAssignableFrom(context.getBackendType())) { template.getOptions().as(AWSEC2TemplateOptions.class) .spotPrice(instanceTemplate.getAwsEc2SpotPrice() != null ? instanceTemplate.getAwsEc2SpotPrice() : spec.getAwsEc2SpotPrice()); } return mapEphemeralIfImageIsEBSBacked(context, spec, template, instanceTemplate); }
when(serviceContext.getComputeService()).thenReturn(computeService); when(computeService.getContext()).thenReturn(serviceContext); when(serviceContext.getBackendType()).thenReturn(TypeToken.class.cast(TypeToken.of(Context.class))); when(computeService.templateBuilder()).thenReturn(templateBuilder); when(templateBuilder.from((TemplateBuilderSpec) any())).thenReturn(templateBuilder);
when(serviceContext.getComputeService()).thenReturn(computeService); when(computeService.getContext()).thenReturn(serviceContext); when(serviceContext.getBackendType()).thenReturn(TypeToken.class.cast(TypeToken.of(Context.class))); when(computeService.templateBuilder()).thenReturn(templateBuilder); when(templateBuilder.from((TemplateBuilderSpec) any())).thenReturn(templateBuilder);