use of com.amazonaws.services.cloudsearchv2.model.DomainStatus in project Synapse-Stack-Builder by Sage-Bionetworks.
the class StackConfigurationSetup method initialize.
public void initialize(AmazonClientFactory factory, InputConfiguration config, GeneratedResources resources) {
if (factory == null)
throw new IllegalArgumentException("AmazonClientFactory cannot be null");
if (config == null)
throw new IllegalArgumentException("Config cannot be null");
if (resources == null)
throw new IllegalArgumentException("GeneratedResources cannot be null");
if (resources.getIdGeneratorDatabase() == null)
throw new IllegalArgumentException("GeneratedResources.getIdGeneratorDatabase() cannot be null");
if (resources.getIdGeneratorDatabase().getEndpoint() == null)
throw new IllegalArgumentException("GeneratedResources.getIdGeneratorDatabase().getEndpoint() cannot be null");
if (resources.getStackInstancesDatabase() == null)
throw new IllegalArgumentException("GeneratedResources.getStackInstancesDatabase() cannot be null");
if (resources.getStackInstancesDatabase().getEndpoint() == null)
throw new IllegalArgumentException("GeneratedResources.getStackInstancesDatabase().getEndpoint() cannot be null");
if (resources.getSearchDomain() == null)
throw new IllegalArgumentException("GeneratedResources.getSearchDomain() cannot be null");
DomainStatus searchStatus = resources.getSearchDomain();
if (resources.getSearchDomain().getSearchService() == null || searchStatus.getSearchService().getEndpoint() == null) {
throw new IllegalArgumentException(String.format("Do not have an endpoint for Search domain: '%1$s' created: '%2$s', processing: '%3$s'", searchStatus.getDomainName(), searchStatus.getCreated(), searchStatus.getProcessing()));
}
if (resources.getSearchDomain().getDocService() == null || resources.getSearchDomain().getDocService().getEndpoint() == null) {
throw new IllegalArgumentException(String.format("Do not have an endpoint for Search documents: '%1$s' created: '%2$s', processing: '%3$s'", searchStatus.getDomainName(), searchStatus.getCreated(), searchStatus.getProcessing()));
}
this.client = factory.createS3Client();
this.config = config;
this.resources = resources;
}
use of com.amazonaws.services.cloudsearchv2.model.DomainStatus in project Synapse-Stack-Builder by Sage-Bionetworks.
the class TestHelper method createTestResources.
/**
* Create GeneratedResources that can be used for a test.
*
* @param config
* @return
*/
public static GeneratedResources createTestResources(InputConfiguration config) {
GeneratedResources resources = new GeneratedResources();
resources.setIdGeneratorDatabase(new DBInstance().withDBInstanceIdentifier(config.getIdGeneratorDatabaseIdentifier()).withEndpoint(new Endpoint().withAddress("id-gen-db.someplace.com")));
resources.setStackInstancesDatabase(new DBInstance().withDBInstanceIdentifier(config.getStackInstanceDatabaseIdentifier()).withEndpoint(new Endpoint().withAddress("stack-instance-db.someplace.com")));
resources.setSearchDomain(new DomainStatus().withSearchService(new ServiceEndpoint().withEndpoint("search-service.someplace.com")));
resources.getSearchDomain().setDocService(new ServiceEndpoint().withEndpoint("doc-service.someplace.com"));
resources.setSslCertificate(StackEnvironmentType.REPO, new ServerCertificateMetadata().withArn("ssl:arn:123"));
resources.setSslCertificate(StackEnvironmentType.WORKERS, new ServerCertificateMetadata().withArn("ssl:arn:123"));
resources.setSslCertificate(StackEnvironmentType.PORTAL, new ServerCertificateMetadata().withArn("ssl:arn:456"));
resources.setACMCertificateArn(StackEnvironmentType.PORTAL, "arn:aws:acm:us-east1:123456789012:certificate/12345678-1234-1234-1234-123456789012");
resources.setACMCertificateArn(StackEnvironmentType.REPO, "arn:aws:acm:us-east1:123456789012:certificate/12345678-1234-1234-1234-223456789012");
resources.setACMCertificateArn(StackEnvironmentType.WORKERS, "arn:aws:acm:us-east1:123456789012:certificate/12345678-1234-1234-1234-323456789012");
resources.setPortalApplicationVersion(new ApplicationVersionDescription().withVersionLabel(config.getVersionLabel(PREFIX_PORTAL)));
resources.setRepoApplicationVersion(new ApplicationVersionDescription().withVersionLabel(config.getVersionLabel(PREFIX_REPO)));
resources.setWorkersApplicationVersion(new ApplicationVersionDescription().withVersionLabel(config.getVersionLabel(PREFIX_WORKERS)));
resources.setStackKeyPair(new KeyPairInfo().withKeyName(config.getStackKeyPairName()));
// Add tables database instances
List<DBInstance> tablesInstances = new LinkedList<DBInstance>();
tablesInstances.add(new DBInstance().withEndpoint(new Endpoint().withAddress("tables.endpoint.one")));
tablesInstances.add(new DBInstance().withEndpoint(new Endpoint().withAddress("tables.endpoint.two")));
resources.setStackInstanceTablesDatabases(tablesInstances);
return resources;
}
use of com.amazonaws.services.cloudsearchv2.model.DomainStatus in project nutch by apache.
the class CloudSearchIndexWriter method open.
@Override
public void open(Configuration conf, String name) throws IOException {
LOG.debug("CloudSearchIndexWriter.open() name={} ", name);
maxDocsInBatch = conf.getInt(CloudSearchConstants.MAX_DOCS_BATCH, -1);
buffer = new StringBuffer(MAX_SIZE_BATCH_BYTES).append('[');
dumpBatchFilesToTemp = conf.getBoolean(CloudSearchConstants.BATCH_DUMP, false);
if (dumpBatchFilesToTemp) {
// no more config required
return;
}
String endpoint = conf.get(CloudSearchConstants.ENDPOINT);
if (StringUtils.isBlank(endpoint)) {
throw new RuntimeException("endpoint not set for CloudSearch");
}
AmazonCloudSearchClient cl = new AmazonCloudSearchClient();
if (StringUtils.isNotBlank(regionName)) {
cl.setRegion(RegionUtils.getRegion(regionName));
}
String domainName = null;
// retrieve the domain name
DescribeDomainsResult domains = cl.describeDomains(new DescribeDomainsRequest());
Iterator<DomainStatus> dsiter = domains.getDomainStatusList().iterator();
while (dsiter.hasNext()) {
DomainStatus ds = dsiter.next();
if (ds.getDocService().getEndpoint().equals(endpoint)) {
domainName = ds.getDomainName();
break;
}
}
// check domain name
if (StringUtils.isBlank(domainName)) {
throw new RuntimeException("No domain name found for CloudSearch endpoint");
}
DescribeIndexFieldsResult indexDescription = cl.describeIndexFields(new DescribeIndexFieldsRequest().withDomainName(domainName));
for (IndexFieldStatus ifs : indexDescription.getIndexFields()) {
String indexname = ifs.getOptions().getIndexFieldName();
String indextype = ifs.getOptions().getIndexFieldType();
LOG.info("CloudSearch index name {} of type {}", indexname, indextype);
csfields.put(indexname, indextype);
}
client = new AmazonCloudSearchDomainClient();
client.setEndpoint(endpoint);
}
Aggregations