use of org.platformlayer.core.model.Link in project platformlayer by platformlayer.
the class StandardTemplateData method getAdditionalKeys.
public void getAdditionalKeys(Map<String, ManagedSecretKey> keys) throws OpsException {
for (Link link : getLinks()) {
ItemBase item = platformLayer.getItem(link.getTarget());
LinkTarget linkTarget = providers.toInterface(item, LinkTarget.class);
PlatformLayerKey caPath = linkTarget.getCaForClientKey();
if (caPath != null) {
String alias = links.buildKeyName(link);
keys.put(alias, findCaSignedKey(caPath, alias));
}
}
}
use of org.platformlayer.core.model.Link in project platformlayer by platformlayer.
the class PutLink method runCommand.
@Override
public Object runCommand() throws PlatformLayerClientException {
PlatformLayerClient client = getPlatformLayerClient();
PlatformLayerKey resolved = path.resolve(getContext());
UntypedItemXml item = (UntypedItemXml) client.getItemUntyped(resolved, Format.XML);
Links links = item.getLinks();
Link link = new Link();
link.name = name;
link.target = target.resolve(getContext());
Link existing = links.findLink(name);
List<Link> linkList = links.getLinks();
if (existing != null) {
linkList.remove(existing);
}
linkList.add(link);
item.setLinks(links);
String xml = item.serialize();
UntypedItemXml updated = (UntypedItemXml) client.putItem(resolved, xml, Format.XML);
return updated.getLinks().getLinks();
}
use of org.platformlayer.core.model.Link in project platformlayer by platformlayer.
the class DeleteLink method runCommand.
@Override
public Object runCommand() throws PlatformLayerClientException {
PlatformLayerClient client = getPlatformLayerClient();
PlatformLayerKey resolved = path.resolve(getContext());
UntypedItemXml item = (UntypedItemXml) client.getItemUntyped(resolved, Format.XML);
Links links = item.getLinks();
Link existing = links.findLink(name);
List<Link> linkList = links.getLinks();
if (existing != null) {
linkList.remove(existing);
item.setLinks(links);
String xml = item.serialize();
UntypedItemXml updated = (UntypedItemXml) client.putItem(resolved, xml, Format.XML);
return updated.getLinks().getLinks();
} else {
return linkList;
}
}
use of org.platformlayer.core.model.Link in project platformlayer by platformlayer.
the class PlatformLayerInstanceTemplate method getLinks.
@Override
protected List<Link> getLinks() throws OpsException {
List<Link> links = Lists.newArrayList();
links.addAll(super.getLinks());
{
// Link to database
Link link = new Link();
link.name = "platformlayer";
link.target = getDatabaseKey();
links.add(link);
}
{
// Link to user auth
Link link = new Link();
link.name = "auth.user";
link.target = model.auth;
links.add(link);
}
{
// Link to system auth (token validation)
Link link = new Link();
link.name = "auth.system";
link.target = model.systemAuth;
links.add(link);
}
return links;
}
use of org.platformlayer.core.model.Link in project platformlayer by platformlayer.
the class CommonAuthTemplateData method getLinks.
@Override
protected List<Link> getLinks() throws OpsException {
List<Link> links = Lists.newArrayList();
links.addAll(super.getLinks());
{
Link link = new Link();
link.name = "auth";
link.target = getAuthDatabaseKey();
links.add(link);
}
return links;
}
Aggregations