Tabnine Logo
MemoryNamedAccountCredentials.getObjects
Code IndexAdd Tabnine to your IDE (free)

How to use
getObjects
method
in
com.netflix.kayenta.memory.security.MemoryNamedAccountCredentials

Best Java code snippets using com.netflix.kayenta.memory.security.MemoryNamedAccountCredentials.getObjects (Showing top 10 results out of 315)

origin: spinnaker/kayenta

private MemoryNamedAccountCredentials getCredentials(String accountName, ObjectType objectType) {
 MemoryNamedAccountCredentials credentials = (MemoryNamedAccountCredentials)accountCredentialsRepository
  .getOne(accountName)
  .orElseThrow(() -> new IllegalArgumentException("Unable to resolve account " + accountName + "."));
 credentials.getObjects().putIfAbsent(objectType, new ConcurrentHashMap<>());
 credentials.getMetadata().putIfAbsent(objectType, new ConcurrentHashMap<>());
 return credentials;
}
origin: spinnaker/kayenta

@Override
public void deleteObject(String accountName, ObjectType objectType, String objectKey) {
 MemoryNamedAccountCredentials credentials = getCredentials(accountName, objectType);
 Object oldValue = credentials.getObjects().get(objectType).remove(objectKey);
 credentials.getMetadata().get(objectType).remove(objectKey);
 if (oldValue == null) {
  throw new IllegalArgumentException("Does not exist");
 }
}
origin: spinnaker/kayenta

@Override
public <T> T loadObject(String accountName, ObjectType objectType, String objectKey) throws IllegalArgumentException {
 MemoryNamedAccountCredentials credentials = getCredentials(accountName, objectType);
 Object entry = credentials.getObjects().get(objectType).get(objectKey);
 if (entry == null) {
  throw new NotFoundException("No such object named " + objectKey);
 }
 return (T)entry;
}
origin: spinnaker/kayenta

@Override
public <T> void storeObject(String accountName, ObjectType objectType, String objectKey, T obj, String filename, boolean isAnUpdate) {
 MemoryNamedAccountCredentials credentials = getCredentials(accountName, objectType);
 long currentTimestamp = System.currentTimeMillis();
 Map<String, Object> objectMetadataMap = new HashMap<>();
 objectMetadataMap.put("id", objectKey);
 objectMetadataMap.put("updatedTimestamp", currentTimestamp);
 objectMetadataMap.put("updatedTimestampIso", Instant.ofEpochMilli(currentTimestamp).toString());
 if (objectType == ObjectType.CANARY_CONFIG) {
  CanaryConfig canaryConfig = (CanaryConfig)obj;
  checkForDuplicateCanaryConfig(accountName, objectType, canaryConfig, objectKey);
  objectMetadataMap.put("name", canaryConfig.getName());
  objectMetadataMap.put("applications", canaryConfig.getApplications());
 }
 credentials.getObjects().get(objectType).put(objectKey, obj);
 credentials.getMetadata().get(objectType).put(objectKey, objectMetadataMap);
}
origin: spinnaker/kayenta

 @Override
 public List<Map<String, Object>> listObjectKeys(String accountName, ObjectType objectType, List<String> applications, boolean skipIndex) {
  MemoryNamedAccountCredentials credentials = getCredentials(accountName, objectType);

  boolean filterOnApplications = applications != null && applications.size() > 0;
  List<Map<String, Object>> result = new ArrayList<>();

  for (Map.Entry<String, Object> entry : credentials.getObjects().get(objectType).entrySet()) {
   String entryKey = entry.getKey();
   if (objectType == ObjectType.CANARY_CONFIG) {
    if (filterOnApplications) {
     CanaryConfig canaryConfig = (CanaryConfig)entry.getValue();

     if (CanaryConfigIndex.haveCommonElements(applications, canaryConfig.getApplications())) {
      result.add(credentials.getMetadata().get(objectType).get(entryKey));
     }
    } else {
     result.add(credentials.getMetadata().get(objectType).get(entryKey));
    }
   } else {
    result.add(credentials.getMetadata().get(objectType).get(entryKey));
   }
  }

  return result;
 }
}
origin: com.netflix.kayenta/kayenta-objectstore-memory

@Override
public void deleteObject(String accountName, ObjectType objectType, String objectKey) {
 MemoryNamedAccountCredentials credentials = getCredentials(accountName, objectType);
 Object oldValue = credentials.getObjects().get(objectType).remove(objectKey);
 credentials.getMetadata().get(objectType).remove(objectKey);
 if (oldValue == null) {
  throw new IllegalArgumentException("Does not exist");
 }
}
origin: com.netflix.kayenta/kayenta-objectstore-memory

private MemoryNamedAccountCredentials getCredentials(String accountName, ObjectType objectType) {
 MemoryNamedAccountCredentials credentials = (MemoryNamedAccountCredentials)accountCredentialsRepository
  .getOne(accountName)
  .orElseThrow(() -> new IllegalArgumentException("Unable to resolve account " + accountName + "."));
 credentials.getObjects().putIfAbsent(objectType, new ConcurrentHashMap<>());
 credentials.getMetadata().putIfAbsent(objectType, new ConcurrentHashMap<>());
 return credentials;
}
origin: com.netflix.kayenta/kayenta-objectstore-memory

@Override
public <T> T loadObject(String accountName, ObjectType objectType, String objectKey) throws IllegalArgumentException {
 MemoryNamedAccountCredentials credentials = getCredentials(accountName, objectType);
 Object entry = credentials.getObjects().get(objectType).get(objectKey);
 if (entry == null) {
  throw new NotFoundException("No such object named " + objectKey);
 }
 return (T)entry;
}
origin: com.netflix.kayenta/kayenta-objectstore-memory

@Override
public <T> void storeObject(String accountName, ObjectType objectType, String objectKey, T obj, String filename, boolean isAnUpdate) {
 MemoryNamedAccountCredentials credentials = getCredentials(accountName, objectType);
 long currentTimestamp = System.currentTimeMillis();
 Map<String, Object> objectMetadataMap = new HashMap<>();
 objectMetadataMap.put("id", objectKey);
 objectMetadataMap.put("updatedTimestamp", currentTimestamp);
 objectMetadataMap.put("updatedTimestampIso", Instant.ofEpochMilli(currentTimestamp).toString());
 if (objectType == ObjectType.CANARY_CONFIG) {
  CanaryConfig canaryConfig = (CanaryConfig)obj;
  checkForDuplicateCanaryConfig(accountName, objectType, canaryConfig, objectKey);
  objectMetadataMap.put("name", canaryConfig.getName());
  objectMetadataMap.put("applications", canaryConfig.getApplications());
 }
 credentials.getObjects().get(objectType).put(objectKey, obj);
 credentials.getMetadata().get(objectType).put(objectKey, objectMetadataMap);
}
origin: com.netflix.kayenta/kayenta-objectstore-memory

 @Override
 public List<Map<String, Object>> listObjectKeys(String accountName, ObjectType objectType, List<String> applications, boolean skipIndex) {
  MemoryNamedAccountCredentials credentials = getCredentials(accountName, objectType);

  boolean filterOnApplications = applications != null && applications.size() > 0;
  List<Map<String, Object>> result = new ArrayList<>();

  for (Map.Entry<String, Object> entry : credentials.getObjects().get(objectType).entrySet()) {
   String entryKey = entry.getKey();
   if (objectType == ObjectType.CANARY_CONFIG) {
    if (filterOnApplications) {
     CanaryConfig canaryConfig = (CanaryConfig)entry.getValue();

     if (CanaryConfigIndex.haveCommonElements(applications, canaryConfig.getApplications())) {
      result.add(credentials.getMetadata().get(objectType).get(entryKey));
     }
    } else {
     result.add(credentials.getMetadata().get(objectType).get(entryKey));
    }
   } else {
    result.add(credentials.getMetadata().get(objectType).get(entryKey));
   }
  }

  return result;
 }
}
com.netflix.kayenta.memory.securityMemoryNamedAccountCredentialsgetObjects

Popular methods of MemoryNamedAccountCredentials

  • builder
  • getMetadata

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setContentView (Activity)
  • getResourceAsStream (ClassLoader)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now