def get(aid): """ Retrieves an api key by its ID. :param aid: The access key id to get. :return: """ return database.get(ApiKey, aid)
def get(policy_id): """ Retrieves policy by its ID. :param policy_id: :return: """ return database.get(RotationPolicy, policy_id)
def update(endpoint_id, **kwargs): endpoint = database.get(Endpoint, endpoint_id) endpoint.policy = kwargs['policy'] endpoint.certificate = kwargs['certificate'] database.update(endpoint) return endpoint
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
def get_by_name(role_name): """ Retrieve a role by its name :param role_name: :return: """ return database.get(Role, role_name, field='name')
def get_by_label(label): """ Retrieves a notification by its label :param label: :return: """ return database.get(Notification, label, field='label')
def get(user_id): """ Retrieve a user from the database :param user_id: :return: """ return database.get(User, user_id)
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')
def get_by_username(username): """ Retrieve a user from the database by their username :param username: :return: """ return database.get(User, username, field='username')
def get(role_id): """ Retrieve a role by ID :param role_id: :return: """ return database.get(Role, role_id)
def get_by_label(label): """ Retrieves a notification by it's label :param label: :return: """ return database.get(Notification, label, field='label')
def get(domain_id): """ Fetches one domain :param domain_id: :return: """ return database.get(Domain, domain_id)
def get(authority_id): """ Retrieves an authority given it's ID :param authority_id: :return: """ return database.get(Authority, authority_id)
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')
def get_by_username(username): """ Retrieve a user from the database by their username :param username: :return: """ return database.get(User, username, field="username")
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")
def get_by_name(role_name): """ Retrieve a role by its name :param role_name: :return: """ return database.get(Role, role_name, field="name")
def get(endpoint_id): """ Retrieves an endpoint given it's ID :param endpoint_id: :return: """ return database.get(Endpoint, endpoint_id)
def get(cert_id): """ Retrieves certificate by it's ID. :param cert_id: :return: """ return database.get(Certificate, cert_id)
def get_by_label(label): """ Retrieves a destination by its label :param label: :return: """ return database.get(Destination, label, field='label')
def get_by_name(name): """ Retrieves certificate by it's Name. :param name: :return: """ return database.get(Certificate, name, field='name')
def get_by_dnsname(dnsname): """ Retrieves an endpoint given it's name. :param dnsname: :return: """ return database.get(Endpoint, dnsname, field='dnsname')
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
def get_by_label(label): """ Retrieves a source by it's label :param label: :return: """ return database.get(Source, label, field='label')
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
def get_by_name(name): """ Retrieves an endpoint given it's name. :param name: :return: """ return database.get(Endpoint, name, field="name")
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)
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)
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)
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
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)
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
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
def get(authorization_id): """ Retrieve dns authorization by ID """ return database.get(Authorization, authorization_id)
def get_by_name(pending_cert_name): """ Retrieve pending certificate by name """ return database.get(PendingCertificate, pending_cert_name, field='name')
def get(pending_cert_id): """ Retrieve pending certificate by ID """ return database.get(PendingCertificate, pending_cert_id)
def get_by_name(pending_cert_name): """ Retrieve pending certificate by name """ return database.get(PendingCertificate, pending_cert_name, field="name")