Example #1
0
def get(aid):
    """
    Retrieves an api key by its ID.
    :param aid: The access key id to get.
    :return:
    """
    return database.get(ApiKey, aid)
Example #2
0
def get(policy_id):
    """
    Retrieves policy by its ID.
    :param policy_id:
    :return:
    """
    return database.get(RotationPolicy, policy_id)
Example #3
0
def get(policy_id):
    """
    Retrieves policy by its ID.
    :param policy_id:
    :return:
    """
    return database.get(RotationPolicy, policy_id)
Example #4
0
def update(endpoint_id, **kwargs):
    endpoint = database.get(Endpoint, endpoint_id)

    endpoint.policy = kwargs['policy']
    endpoint.certificate = kwargs['certificate']
    database.update(endpoint)
    return endpoint
Example #5
0
def update(endpoint_id, **kwargs):
    endpoint = database.get(Endpoint, endpoint_id)

    endpoint.policy = kwargs["policy"]
    endpoint.certificate = kwargs["certificate"]
    endpoint.source = kwargs["source"]
    endpoint.certificate_path = kwargs.get("certificate_path")
    endpoint.registry_type = kwargs.get("registry_type")
    existing_alias = {}
    for e in endpoint.aliases:
        existing_alias[e.alias] = e
    endpoint.aliases = []
    if "aliases" in kwargs:
        for name in kwargs["aliases"]:
            if name in existing_alias:
                endpoint.aliases.append(existing_alias[name])
            else:
                endpoint.aliases.append(EndpointDnsAlias(alias=name))
    endpoint.last_updated = arrow.utcnow()
    metrics.send(
        "endpoint_updated", "counter", 1,
        metric_tags={"source": endpoint.source.label, "type": endpoint.type}
    )
    database.update(endpoint)
    return endpoint
Example #6
0
def get_by_name(role_name):
    """
    Retrieve a role by its name

    :param role_name:
    :return:
    """
    return database.get(Role, role_name, field='name')
Example #7
0
def get_by_label(label):
    """
    Retrieves a notification by its label

    :param label:
    :return:
    """
    return database.get(Notification, label, field='label')
Example #8
0
def get(user_id):
    """
    Retrieve a user from the database

    :param user_id:
    :return:
    """
    return database.get(User, user_id)
Example #9
0
def get_by_email(email):
    """
    Retrieve a user from the database by their email address

    :param email:
    :return:
    """
    return database.get(User, email, field='email')
Example #10
0
def get_by_username(username):
    """
    Retrieve a user from the database by their username

    :param username:
    :return:
    """
    return database.get(User, username, field='username')
Example #11
0
def get(role_id):
    """
    Retrieve a role by ID

    :param role_id:
    :return:
    """
    return database.get(Role, role_id)
Example #12
0
def get_by_label(label):
    """
    Retrieves a notification by it's label

    :param label:
    :return:
    """
    return database.get(Notification, label, field='label')
Example #13
0
def get(role_id):
    """
    Retrieve a role by ID

    :param role_id:
    :return:
    """
    return database.get(Role, role_id)
Example #14
0
def get(domain_id):
    """
    Fetches one domain

    :param domain_id:
    :return:
    """
    return database.get(Domain, domain_id)
Example #15
0
def get(authority_id):
    """
    Retrieves an authority given it's ID

    :param authority_id:
    :return:
    """
    return database.get(Authority, authority_id)
Example #16
0
def get(user_id):
    """
    Retrieve a user from the database

    :param user_id:
    :return:
    """
    return database.get(User, user_id)
Example #17
0
def get_by_name(authority_name):
    """
    Retrieves an authority given it's name.

    :param authority_name:
    :return:
    """
    return database.get(Authority, authority_name, field='name')
Example #18
0
def get_by_username(username):
    """
    Retrieve a user from the database by their username

    :param username:
    :return:
    """
    return database.get(User, username, field="username")
Example #19
0
def get_by_email(email):
    """
    Retrieve a user from the database by their email address

    :param email:
    :return:
    """
    return database.get(User, email, field="email")
Example #20
0
def get(domain_id):
    """
    Fetches one domain

    :param domain_id:
    :return:
    """
    return database.get(Domain, domain_id)
Example #21
0
def get_by_name(role_name):
    """
    Retrieve a role by its name

    :param role_name:
    :return:
    """
    return database.get(Role, role_name, field="name")
Example #22
0
def get(endpoint_id):
    """
    Retrieves an endpoint given it's ID

    :param endpoint_id:
    :return:
    """
    return database.get(Endpoint, endpoint_id)
Example #23
0
def get(cert_id):
    """
    Retrieves certificate by it's ID.

    :param cert_id:
    :return:
    """
    return database.get(Certificate, cert_id)
Example #24
0
def get_by_label(label):
    """
    Retrieves a destination by its label

    :param label:
    :return:
    """
    return database.get(Destination, label, field='label')
Example #25
0
def get_by_name(name):
    """
    Retrieves certificate by it's Name.

    :param name:
    :return:
    """
    return database.get(Certificate, name, field='name')
Example #26
0
def get_by_label(label):
    """
    Retrieves a destination by its label

    :param label:
    :return:
    """
    return database.get(Destination, label, field='label')
Example #27
0
def get_by_dnsname(dnsname):
    """
    Retrieves an endpoint given it's name.

    :param dnsname:
    :return:
    """
    return database.get(Endpoint, dnsname, field='dnsname')
Example #28
0
def get_by_name(authority_name):
    """
    Retrieves an authority given it's name.

    :param authority_name:
    :return:
    """
    return database.get(Authority, authority_name, field='name')
Example #29
0
def get_or_create_policy(**kwargs):
    policy = database.get(Policy, kwargs['name'], field='name')

    if not policy:
        policy = Policy(**kwargs)
        database.create(policy)

    return policy
Example #30
0
def get(authority_id):
    """
    Retrieves an authority given it's ID

    :param authority_id:
    :return:
    """
    return database.get(Authority, authority_id)
Example #31
0
def get_by_name(name):
    """
    Retrieves certificate by it's Name.

    :param name:
    :return:
    """
    return database.get(Certificate, name, field='name')
Example #32
0
def get_by_label(label):
    """
    Retrieves a source by it's label

    :param label:
    :return:
    """
    return database.get(Source, label, field='label')
Example #33
0
def get(cert_id):
    """
    Retrieves certificate by it's ID.

    :param cert_id:
    :return:
    """
    return database.get(Certificate, cert_id)
Example #34
0
def get_by_dnsname(dnsname):
    """
    Retrieves an endpoint given it's name.

    :param dnsname:
    :return:
    """
    return database.get(Endpoint, dnsname, field='dnsname')
Example #35
0
def get_or_create_cipher(**kwargs):
    cipher = database.get(Cipher, kwargs['name'], field='name')

    if not cipher:
        cipher = Cipher(**kwargs)
        database.create(cipher)

    return cipher
Example #36
0
def get(endpoint_id):
    """
    Retrieves an endpoint given it's ID

    :param endpoint_id:
    :return:
    """
    return database.get(Endpoint, endpoint_id)
Example #37
0
def get_or_create_policy(**kwargs):
    policy = database.get(Policy, kwargs['name'], field='name')

    if not policy:
        policy = Policy(**kwargs)
        database.create(policy)

    return policy
Example #38
0
def get_by_label(label):
    """
    Retrieves a source by it's label

    :param label:
    :return:
    """
    return database.get(Source, label, field='label')
Example #39
0
def get_or_create_cipher(**kwargs):
    cipher = database.get(Cipher, kwargs['name'], field='name')

    if not cipher:
        cipher = Cipher(**kwargs)
        database.create(cipher)

    return cipher
Example #40
0
def get_by_name(name):
    """
    Retrieves an endpoint given it's name.

    :param name:
    :return:
    """
    return database.get(Endpoint, name, field="name")
Example #41
0
def get(source_id):
    """
    Retrieves an source by it's lemur assigned ID.

    :param source_id: Lemur assigned ID
    :rtype : Source
    :return:
    """
    return database.get(Source, source_id)
Example #42
0
def get(source_id):
    """
    Retrieves an source by it's lemur assigned ID.

    :param source_id: Lemur assigned ID
    :rtype : Source
    :return:
    """
    return database.get(Source, source_id)
Example #43
0
def get(notification_id):
    """
    Retrieves an notification by it's lemur assigned ID.

    :param notification_id: Lemur assigned ID
    :rtype : Notification
    :return:
    """
    return database.get(Notification, notification_id)
Example #44
0
def get(destination_id):
    """
    Retrieves an destination by its lemur assigned ID.

    :param destination_id: Lemur assigned ID
    :rtype : Destination
    :return:
    """
    return database.get(Destination, destination_id)
Example #45
0
def get(destination_id):
    """
    Retrieves an destination by its lemur assigned ID.

    :param destination_id: Lemur assigned ID
    :rtype : Destination
    :return:
    """
    return database.get(Destination, destination_id)
Example #46
0
def update(endpoint_id, **kwargs):
    endpoint = database.get(Endpoint, endpoint_id)

    endpoint.policy = kwargs['policy']
    endpoint.certificate = kwargs['certificate']
    endpoint.source = kwargs['source']
    metrics.send('endpoint_added', 'counter', 1)
    database.update(endpoint)
    return endpoint
Example #47
0
def get(notification_id):
    """
    Retrieves an notification by its lemur assigned ID.

    :param notification_id: Lemur assigned ID
    :rtype : Notification
    :return:
    """
    return database.get(Notification, notification_id)
Example #48
0
def update(endpoint_id, **kwargs):
    endpoint = database.get(Endpoint, endpoint_id)

    endpoint.policy = kwargs['policy']
    endpoint.certificate = kwargs['certificate']
    endpoint.source = kwargs['source']
    endpoint.last_updated = arrow.utcnow()
    metrics.send('endpoint_updated', 'counter', 1, metric_tags={'source': endpoint.source.label})
    database.update(endpoint)
    return endpoint
Example #49
0
def update(endpoint_id, **kwargs):
    endpoint = database.get(Endpoint, endpoint_id)

    endpoint.policy = kwargs['policy']
    endpoint.certificate = kwargs['certificate']
    endpoint.source = kwargs['source']
    endpoint.last_updated = arrow.utcnow()
    metrics.send('endpoint_updated', 'counter', 1, metric_tags={'source': endpoint.source.label})
    database.update(endpoint)
    return endpoint
Example #50
0
def update(endpoint_id, **kwargs):
    endpoint = database.get(Endpoint, endpoint_id)

    endpoint.policy = kwargs["policy"]
    endpoint.certificate = kwargs["certificate"]
    endpoint.source = kwargs["source"]
    endpoint.last_updated = arrow.utcnow()
    metrics.send("endpoint_updated",
                 "counter",
                 1,
                 metric_tags={"source": endpoint.source.label})
    database.update(endpoint)
    return endpoint
Example #51
0
def get(authorization_id):
    """
    Retrieve dns authorization by ID
    """
    return database.get(Authorization, authorization_id)
Example #52
0
def get_by_name(pending_cert_name):
    """
    Retrieve pending certificate by name
    """
    return database.get(PendingCertificate, pending_cert_name, field='name')
Example #53
0
def get(pending_cert_id):
    """
    Retrieve pending certificate by ID
    """
    return database.get(PendingCertificate, pending_cert_id)
Example #54
0
def get(pending_cert_id):
    """
    Retrieve pending certificate by ID
    """
    return database.get(PendingCertificate, pending_cert_id)
Example #55
0
def get_by_name(pending_cert_name):
    """
    Retrieve pending certificate by name
    """
    return database.get(PendingCertificate, pending_cert_name, field="name")