Пример #1
0
def getSecretAction(args, location, region, **session_params):
    try:
        if WILDCARD_CHAR in args.credential:
            names = expand_wildcard(args.credential,
                                    [x["name"]
                                     for x
                                     in listSecrets(region=region,
                                                    location=location,
                                                    only_latest=True,
                                                    **session_params)])
            print(json.dumps(dict((name,
                                   getSecret(name,
                                             args.version,
                                             region=region,
                                             location=location,
                                             context=args.context,
                                             **session_params))
                                  for name in names)))
        else:
            sys.stdout.write(getSecret(args.credential, args.version,
                                       region=region, location=location,
                                       context=args.context,
                                       **session_params))
            if not args.noline:
                sys.stdout.write("\n")
    except ItemNotFound as e:
        fatal(e)
    except KmsError as e:
        fatal(e)
    except IntegrityError as e:
        fatal(e)
Пример #2
0
 def test_three_wild_card_with_many_matches(self):
     self.assertEqual(expand_wildcard("Q*E*Q*E", self.secrets_set2), ["QrEQrE", "QErQE"])
Пример #3
0
 def test_two_wild_cards_with_many_matches(self):
     self.assertEqual(expand_wildcard("Q*Q*Q", self.secrets_set2), ["QQQ", "QVQQ", "QVQVQ", "QQVQ"])
Пример #4
0
 def test_one_wild_card_with_many_matches(self):
     self.assertEqual(expand_wildcard("a*b", self.secrets_set), ["ab", "a b", "aabb"])
Пример #5
0
 def test_one_wild_card_with_one_match(self):
     self.assertEqual(expand_wildcard("a*z", self.secrets_set), ["a[anyvalue]z"])
Пример #6
0
 def test_exact_match_regex(self):
     self.assertEqual(expand_wildcard("abc", self.secrets_set), ["abc"])
Пример #7
0
 def test_end_regex(self):
     self.assertEqual(expand_wildcard("ba", self.secrets_set), ["ba"])
Пример #8
0
 def test_start_regex(self):
     self.assertEqual(expand_wildcard("a", self.secrets_set), ["a"])
Пример #9
0
 def test_three_wild_card_with_many_matches(self):
     self.assertEqual(expand_wildcard("Q*E*Q*E", self.secrets_set2),
                      ["QrEQrE", "QErQE"])
Пример #10
0
 def test_two_wild_cards_with_many_matches(self):
     self.assertEqual(expand_wildcard("Q*Q*Q", self.secrets_set2),
                      ["QQQ", "QVQQ", "QVQVQ", "QQVQ"])
Пример #11
0
 def test_one_wild_card_with_many_matches(self):
     self.assertEqual(expand_wildcard("a*b", self.secrets_set),
                      ["ab", "a b", "aabb"])
Пример #12
0
 def test_one_wild_card_with_one_match(self):
     self.assertEqual(expand_wildcard("a*z", self.secrets_set),
                      ["a[anyvalue]z"])
Пример #13
0
 def test_exact_match_regex(self):
     self.assertEqual(expand_wildcard("abc", self.secrets_set), ["abc"])
Пример #14
0
 def test_end_regex(self):
     self.assertEqual(expand_wildcard("ba", self.secrets_set), ["ba"])
Пример #15
0
 def test_start_regex(self):
     self.assertEqual(expand_wildcard("a", self.secrets_set), ["a"])