MCPcopy Create free account
hub / github.com/StackStorm/st2 / KeyValuePairDB

Class KeyValuePairDB

st2common/st2common/models/db/keyvalue.py:27–53  ·  view source on GitHub ↗

Attribute: name: Name of the key. value: Arbitrary value to be stored.

Source from the content-addressed store, hash-verified

25
26
27class KeyValuePairDB(stormbase.StormBaseDB, stormbase.UIDFieldMixin):
28 """
29 Attribute:
30 name: Name of the key.
31 value: Arbitrary value to be stored.
32 """
33
34 RESOURCE_TYPE = ResourceType.KEY_VALUE_PAIR
35 UID_FIELDS = ["scope", "name"]
36
37 scope = me.StringField(default=FULL_SYSTEM_SCOPE, unique_with="name")
38 name = me.StringField(required=True)
39 value = me.StringField()
40 secret = me.BooleanField(default=False)
41 expire_timestamp = me.DateTimeField()
42
43 meta = {
44 "indexes": [
45 {"fields": ["name"]},
46 {"fields": ["expire_timestamp"], "expireAfterSeconds": 0},
47 ]
48 + stormbase.UIDFieldMixin.get_indexes()
49 }
50
51 def __init__(self, *args, **values):
52 super(KeyValuePairDB, self).__init__(*args, **values)
53 self.uid = self.get_uid()
54
55
56# specialized access objects

Callers 15

test_system_transformMethod · 0.90
setUpClassMethod · 0.90
get_oneMethod · 0.90
get_allMethod · 0.90
putMethod · 0.90
deleteMethod · 0.90

Calls 1

get_indexesMethod · 0.45