Listing nodes using jclouds - amazon-ec2

Is it possible to list nodes in a non-default AWS VPC? This can be done easily using EC2::DescribeInstances by passing a filter with vpc-id= but I can't figure out how to do it using jclouds.
I know how to create an instance in a specified VPC using template options, but I cannot find an equivalent approach for listing nodes. I'm currently using listNodesDetailsMatching(...).

You cannot eagerly filter that on the provider. Using the portable interface you can just provide a predicate to filter nodes once you have them all. You can directly use the underlying AWS EC2 API to do what you want. It could be something like the following:
AWSEC2Api aws = computeServiceContext.unwrapApi(AWSEC2Api.class);
AWSInstanceApi instanceApi = aws.getInstanceApi().get();
instanceApi.describeInstancesInRegionWithFilter("region", ImmutableMultimap.of("vpc-id", "myvpc"));

Related

Implement AEM search using query builder API using wildcard-contains in node name

I have a requirement to fetch search results based on partial/wild card in node name to retrieve AEM forms portal data.
For example, if there are multiple draft Id node under any user-email (Unique node created under /conten/forms/fp). each draft application node will reside under conten/forms/fp/.com|.net/metadata/draftId
Note: User nodes will have .com or .net in the end. Image also attached for reference. I should get testsonar#mailiantor.com/testsonar%40#mailinator.com as result since the user has more than one draft application.
My requirement is to find out users who are having multiple drafts. Can anyone suggest this would be possible using Query builder API . I have tried below predicate but noticed that wild card is not supporting in path.
type=nt:unstructured
path=/content/forms/fp/*/drafts/metadata
path.exact=false
path.false=false
When using predicates you should be able to use something like this:
group.1_property.value=%term%
group.1_property=jcr:path
group.1_property.operation=like

Pagination feature in Pivotal GemFire

Is there any built-in API which provides a pagination feature in Pivotal GemFire, such as in the QueryService API or using Functions? We are currently using Pivotal GemFire 9.3.0 running in PCC.
TIA.
No yet. It is a planned feature for SD Lovelace/Moore release trains. See SGF-524 - Add support for PagingAndSortingRepositories. NOTE: sorting is already supported; paging is a WIP.
There is not. However there is a common pattern for this. Instead of directly querying the matching objects, write your query to return the keys of the matching objects. The client can then implement paging (e.g. page1 is key0-key99, page 2 is key 100-199, etc.). Use the "getAll" method with a list of keys to pull back one page at a time.
BTW, you can query the keys like this: "select key from /person.entries where value.ssn='222-22-2222'"

Ansible: want to map dynamic hosts with instance-id's

My code : http://pastebin.com/jzrYTR2u
What I want to achieve: My script should dynamically take the hosts with specific tag and perform the above tasks on each host one by one. Currently, I am taking the instance-id from elb_facts module.
What I have achieved till now: My script will take the first instance out from elb, will perform the deploy tasks, add back to elb. hosts file is currently hardcoded with IPs
Use the boto api to make a connection with AWS and use filters to find the instances you want. You can then recursively search through the list to get the instances and then the instance id's. An example below to make the request for filtered instances:
filters = dict()
filters["tag:Profile"] = node["profile"]
filters["tag:Environment"] = environment
filters["availability_zone"] = region + node["distribution"][index]["zone"]
filters["tag:ServiceName"] = node['service_name']
instances_aws = aws_connection.get_all_instances(filters=filters)
Hope this helps

FHIR Search by Referencing Resources

Is there a way to search for a resource by its referencing resources? For example, is the a way to find all Observations of code = X with Provenance by agent Y?
GET [base]/Observation?code=X&???
One could:
GET [base]/Provenance?userid=Y&_include=Provenance:target:Observation
but that prevents any kind of filtering on Observation (which may create a volume problem in the response!). Also, I don't need the provenance resource - I just need to make sure that the Observations I'm using have a certain provenance.
Right now, to the best of my knowledge, there's no way to apply filters to multiple resources unless you're using _filter or using a custom OperationDefinition.

creating an ec2 instance from an image - finding kernel id attributes using boto

I've got an EC2 snapshot from a running machine. When I create an image and then an instance out of it, it fails the reachability test, and I can't connect to it. I checked the volume and it's got no errors by attaching to another machine.
I now suspect that I have to choose the right kernel-id, and that the default might not be compatible.
Looking at other EC2 instances I have, they are running kernel id aki-427d952b, but this kernel is not available from the dropdown list (even in the same availability zone).
How do I find the next-best kernel id? Is there some list of kernel ids and which versions/architectures they support?
EDIT: can e.g. python boto or another library be used to list all kernel-ids and attributes to allow choosing a different kernel-id from aki-427d952b (which is missing from the dropdown list).
Boto can certainly be used to list images, and you can get data about their configuration. Whether that's the best way to search for a replacement is another question, but, if you want to do it, here's the python/boto code
# use your AWS id and Secret here
conn = EC2Connection(awsid, awssecret)
# returns array of all images your account can use
all_images = conn.get_all_images()
for img in all_images:
attrs = img.__dict__
# attrs will be a dictionary of key-value pairs associated
# with the image. Look through them to find what you want.
if img.kernel_id == 'aki-427d952b':
print "found aki-427d952b: imgid=" + img.id

Resources