org.jclouds.domain.LocationBuilder Java Examples

The following examples show how to use org.jclouds.domain.LocationBuilder. 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: StubbedComputeServiceRegistry.java    From brooklyn-server with Apache License 2.0 6 votes vote down vote up
@Override
protected NodeMetadata newNode(String group, Template template) {
    int suffix = counter.getAndIncrement();
    org.jclouds.domain.Location region = new LocationBuilder()
            .scope(LocationScope.REGION)
            .id("us-east-1")
            .description("us-east-1")
            .parent(new LocationBuilder()
                    .scope(LocationScope.PROVIDER)
                    .id("aws-ec2")
                    .description("aws-ec2")
                    .build())
            .build();
    NodeMetadata result = new NodeMetadataBuilder()
            .id("mynodeid"+suffix)
            .credentials(LoginCredentials.builder().identity("myuser").credential("mypassword").build())
            .loginPort(22)
            .status(Status.RUNNING)
            .publicAddresses(ImmutableList.of("173.194.32."+suffix))
            .privateAddresses(ImmutableList.of("172.168.10."+suffix))
            .location(region)
            .build();
    return result;
}
 
Example #2
Source File: JCloudsAppStorageService.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static Location createRegionLocation( BlobStoreProperties config, Location provider )
{
    return config.location != null ?
        new LocationBuilder()
            .scope( LocationScope.REGION )
            .id( config.location )
            .description( config.location )
            .parent( provider )
            .build() : null;
}
 
Example #3
Source File: JCloudsFileResourceContentStore.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static Location createRegionLocation( BlobStoreProperties config, Location provider )
{
    return config.location != null ?
        new LocationBuilder()
            .scope( LocationScope.REGION )
            .id( config.location )
            .description( config.location )
            .parent( provider )
            .build() : null;
}
 
Example #4
Source File: BlobStoreManagedLedgerOffloader.java    From pulsar with Apache License 2.0 5 votes vote down vote up
BlobStoreManagedLedgerOffloader(String driver, String container, OrderedScheduler scheduler,
                                int maxBlockSize, int readBufferSize,
                                String endpoint, String region, Supplier<Credentials> credentials,
                                Map<String, String> userMetadata) {
    this.offloadDriverName = driver;
    this.scheduler = scheduler;
    this.readBufferSize = readBufferSize;
    this.writeBucket = container;
    this.writeRegion = region;
    this.writeEndpoint = endpoint;
    this.maxBlockSize = maxBlockSize;
    this.userMetadata = userMetadata;
    this.credentials = credentials;

    if (!Strings.isNullOrEmpty(region)) {
        this.writeLocation = new LocationBuilder()
            .scope(LocationScope.REGION)
            .id(region)
            .description(region)
            .build();
    } else {
        this.writeLocation = null;
    }

    log.info("Constructor offload driver: {}, host: {}, container: {}, region: {} ",
        driver, endpoint, container, region);

    Pair<BlobStoreLocation, BlobStore> blobStore = createBlobStore(
        driver, region, endpoint, credentials, maxBlockSize
    );
    this.writeBlobStore = blobStore.getRight();
    this.readBlobStores.put(blobStore.getLeft(), blobStore.getRight());
}
 
Example #5
Source File: JcloudsStubTemplateBuilder.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
public JcloudsStubTemplateBuilder(String providerName, String regionName) {
    this.providerName = providerName;
    this.regionName = regionName;
    this.provider = new LocationBuilder().scope(LocationScope.PROVIDER).id(providerName).description(providerName).build();
    this.jcloudsDomainLocation = new LocationBuilder().scope(LocationScope.REGION).id(this.regionName).description(this.regionName)
            .parent(provider).build();
}
 
Example #6
Source File: GenerateTempURL.java    From jclouds-examples with Apache License 2.0 5 votes vote down vote up
private void createContainer() throws IOException {
   // Ensure that the container exists
   Location location = new LocationBuilder().scope(LocationScope.REGION).id(REGION).description("region").build();
   if (!blobStore.containerExists(CONTAINER)) {
         blobStore.createContainerInLocation(location, CONTAINER);
      System.out.format("Created container in %s%n", REGION);
   }
}