예제 #1
0
class SbankenTransaction(jsonobject.JsonObject):
    'Objectify Sbanken Transaction'
    # properties defined in Sbanken json structs
    #  {'accountNumber': '', # str
    # 'accountingDate': '2018-01-22T00:00:00+01:00',
    # 'amount': 1.5, # float
    # 'customerId': '', # str, norwegian ssn
    # 'interestDate': '2018-01-21T00:00:00+01:00',
    # 'otherAccountNumber': None,
    # 'registrationDate': None,
    # 'text': '', # str
    # 'transactionId': '', # str
    # 'transactionType': 'RKI'} # one of RKI,
    accountNumber = jsonobject.StringProperty()
    accountingDate = jsonobject.DefaultProperty(
    )  # TODO: use DateTimeProperty()
    amount = jsonobject.FloatProperty()
    customerId = jsonobject.StringProperty()
    interestDate = jsonobject.DefaultProperty()  # TODO: use DateTimeProperty()
    otherAccountNumber = jsonobject.StringProperty()
    registrationDate = jsonobject.DefaultProperty(
    )  # TODO: use DateTimeProperty()
    text = jsonobject.StringProperty()
    transactionId = jsonobject.StringProperty()
    transactionType = jsonobject.StringProperty()
예제 #2
0
class FabricInstallerDataV1(JsonObject):
    version = IntegerProperty(required=True)
    libraries = ObjectProperty(FabricInstallerLibraries, required=True)
    mainClass = jsonobject.DefaultProperty()
    arguments = ObjectProperty(FabricInstallerArguments, required=False)
    launchwrapper = ObjectProperty(FabricInstallerLaunchwrapper,
                                   required=False)
예제 #3
0
class SbankenUser(jsonobject.JsonObject):
    'Objectify Sbanken User'
    # properties defined in Sbanken json structs
    # {'customerId': '', # str, norwegian ssn
    # 'dateOfBirth': 'YYYY-MM-DDT00:00:00', # str, timestamp
    # 'emailAddress': '', # str, email
    # 'firstName': '', # str
    # 'lastName': '', # str
    # 'phoneNumbers': [{'countryCode': '', 'number': ''},
    #                 {'countryCode': '', 'number': ''}],
    # 'postalAddress': {'addressLine1': '',
    #                 'addressLine2': '',
    #                 'addressLine3': '',
    #                 'addressLine4': '',
    #                 'city': None,
    #                 'country': '',
    #                 'zipCode': None},
    # 'streetAddress': {'addressLine1': '',
    #                 'addressLine2': '',
    #                 'addressLine3': None,
    #                 'addressLine4': None,
    #                 'city': '',
    #                 'country': None,
    #                 'zipCode': ''}
    customerId = jsonobject.StringProperty()
    dateOfBirth = jsonobject.DefaultProperty()  # TODO: use DateTimeProperty()
    emailAddress = jsonobject.StringProperty()
    firstName = jsonobject.StringProperty()
    lastName = jsonobject.StringProperty()
    phoneNumbers = jsonobject.ListProperty(SbankenPhoneNumber)
    postalAddress = jsonobject.ObjectProperty(SbankenAddress)
    streetAddress = jsonobject.ObjectProperty(SbankenAddress)
예제 #4
0
class SecretSpec(jsonobject.JsonObject):
    name = jsonobject.StringProperty(required=True)
    required = jsonobject.BooleanProperty(default=False)
    default = jsonobject.DefaultProperty(default=None)
    default_overrides_falsy_values = jsonobject.BooleanProperty(default=False)
    fall_back_to_vars = jsonobject.ListProperty(str)
    deprecated = jsonobject.BooleanProperty(default=False)
    legacy_namespace = jsonobject.StringProperty(
        choices=('localsettings_private', 'secrets', None))
    ansible_var_lowercase = jsonobject.BooleanProperty(default=False)

    @classmethod
    def wrap(cls, data):
        self = super(SecretSpec, cls).wrap(data)
        if self.required:
            assert self.default is None, "A required secret cannot also have a default."
        return self

    def get_legacy_reference(self):
        if self.legacy_namespace:
            return "{}.{}".format(self.legacy_namespace, self.name)
        else:
            return self.name

    def get_ansible_var_name(self):
        if self.ansible_var_lowercase:
            return self.name.lower()
        else:
            return self.name

    def get_ansible_expression(self, expression_base_function,
                               other_secret_specs_by_name):
        expression = expression_base_function(self)
        for var_name in self.fall_back_to_vars:
            expression += ' | default({})'.format(
                other_secret_specs_by_name[var_name].get_ansible_var_name())
        if not self.required:
            if self.default_overrides_falsy_values:
                expression += ' | default({}, true)'.format(
                    repr(self.default).strip('u'))
            else:
                expression += ' | default({})'.format(
                    repr(self.default).strip('u'))
        if expression == self.name:
            # avoid redundant/cyclical `x: {{ x }}`
            return None
        else:
            return "{{{{ {} }}}}".format(expression)
예제 #5
0
class PGConfigItem(jsonobject.JsonObject):
    _allow_dynamic_properties = False

    name = jsonobject.StringProperty()
    value = jsonobject.DefaultProperty()
예제 #6
0
class QuiltInstallerDataV1(JsonObject):
    version = IntegerProperty(required=True)
    libraries = ObjectProperty(QuiltInstallerLibraries, required=True)
    mainClass = jsonobject.DefaultProperty()
    arguments = ObjectProperty(QuiltInstallerArguments, required=False)