-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cloudfoundry): add support for manifest random route (#5383)
- Loading branch information
1 parent
faf36cb
commit b431f10
Showing
6 changed files
with
291 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
215 changes: 215 additions & 0 deletions
215
.../java/com/netflix/spinnaker/clouddriver/cloudfoundry/deploy/util/RandomWordGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
package com.netflix.spinnaker.clouddriver.cloudfoundry.deploy.util; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.concurrent.ThreadLocalRandom; | ||
|
||
// Based on | ||
// https://github.com/cloudfoundry/cli/blob/8c20e5118d7cb38f52d52b69060f6b77943dce6e/util/randomword/generator.go | ||
public class RandomWordGenerator { | ||
private static final List<String> adjectives = | ||
Arrays.asList( | ||
"accountable", | ||
"active", | ||
"agile", | ||
"anxious", | ||
"appreciative", | ||
"balanced", | ||
"boisterous", | ||
"bold", | ||
"boring", | ||
"brash", | ||
"brave", | ||
"bright", | ||
"busy", | ||
"chatty", | ||
"cheerful", | ||
"chipper", | ||
"comedic", | ||
"courteous", | ||
"daring", | ||
"delightful", | ||
"empathic", | ||
"excellent", | ||
"exhausted", | ||
"fantastic", | ||
"fearless", | ||
"fluent", | ||
"forgiving", | ||
"friendly", | ||
"funny", | ||
"generous", | ||
"grateful", | ||
"grouchy", | ||
"grumpy", | ||
"happy", | ||
"hilarious", | ||
"humble", | ||
"impressive", | ||
"insightful", | ||
"intelligent", | ||
"interested", | ||
"kind", | ||
"lean", | ||
"nice", | ||
"noisy", | ||
"optimistic", | ||
"patient", | ||
"persistent", | ||
"proud", | ||
"quick", | ||
"quiet", | ||
"reflective", | ||
"relaxed", | ||
"reliable", | ||
"responsible", | ||
"responsive", | ||
"rested", | ||
"restless", | ||
"shiny", | ||
"shy", | ||
"silly", | ||
"sleepy", | ||
"smart", | ||
"spontaneous", | ||
"surprised", | ||
"sweet", | ||
"talkative", | ||
"terrific", | ||
"thankful", | ||
"timely", | ||
"tired", | ||
"turbulent", | ||
"unexpected", | ||
"wacky", | ||
"wise", | ||
"zany"); | ||
|
||
private static final List<String> nouns = | ||
Arrays.asList( | ||
"ardvark", | ||
"alligator", | ||
"antelope", | ||
"baboon", | ||
"badger", | ||
"bandicoot", | ||
"bat", | ||
"bear", | ||
"bilby", | ||
"bongo", | ||
"bonobo", | ||
"buffalo", | ||
"bushbuck", | ||
"camel", | ||
"cassowary", | ||
"cat", | ||
"cheetah", | ||
"chimpanzee", | ||
"chipmunk", | ||
"civet", | ||
"crane", | ||
"crocodile", | ||
"dingo", | ||
"dog", | ||
"dugong", | ||
"duiker", | ||
"echidna", | ||
"eland", | ||
"elephant", | ||
"emu", | ||
"fossa", | ||
"fox", | ||
"gazelle", | ||
"gecko", | ||
"gelada", | ||
"genet", | ||
"gerenuk", | ||
"giraffe", | ||
"gnu", | ||
"gorilla", | ||
"grysbok", | ||
"hartebeest", | ||
"hedgehog", | ||
"hippopotamus", | ||
"hyena", | ||
"hyrax", | ||
"impala", | ||
"jackal", | ||
"jaguar", | ||
"kangaroo", | ||
"klipspringer", | ||
"koala", | ||
"kob", | ||
"kookaburra", | ||
"kudu", | ||
"lemur", | ||
"leopard", | ||
"lion", | ||
"lizard", | ||
"llama", | ||
"lynx", | ||
"manatee", | ||
"mandrill", | ||
"meerkat", | ||
"mongoose", | ||
"mouse", | ||
"numbat", | ||
"nyala", | ||
"okapi", | ||
"oribi", | ||
"oryx", | ||
"ostrich", | ||
"otter", | ||
"panda", | ||
"pangolin", | ||
"panther", | ||
"parrot", | ||
"platypus", | ||
"porcupine", | ||
"possum", | ||
"puku", | ||
"quokka", | ||
"quoll", | ||
"rabbit", | ||
"ratel", | ||
"raven", | ||
"reedbuck", | ||
"rhinocerous", | ||
"roan", | ||
"sable", | ||
"serval", | ||
"shark", | ||
"sitatunga", | ||
"springhare", | ||
"squirrel", | ||
"swan", | ||
"tasmaniandevil", | ||
"tiger", | ||
"topi", | ||
"toucan", | ||
"turtle", | ||
"wallaby", | ||
"warthog", | ||
"waterbuck", | ||
"wildebeest", | ||
"wolf", | ||
"wolverine", | ||
"wombat", | ||
"zebra"); | ||
|
||
public static String randomQualifiedNoun() { | ||
return randomAdjective() + randomNoun(); | ||
} | ||
|
||
public static String randomAdjective() { | ||
return randomElement(adjectives); | ||
} | ||
|
||
public static String randomNoun() { | ||
return randomElement(nouns); | ||
} | ||
|
||
public static String randomElement(List<String> elements) { | ||
return elements.get(ThreadLocalRandom.current().nextInt(elements.size())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters