def create_domain(self, context, values): domain = self.storage_conn.create_domain(context, values) agent_api.create_domain(context, domain) utils.notify(context, "api", "domain.create", domain) return domain
def delete_domain(self, context, domain_id): domain = self.storage_conn.get_domain(context, domain_id) agent_api.delete_domain(context, domain) utils.notify(context, 'api', 'domain.delete', domain) return self.storage_conn.delete_domain(context, domain_id)
def update_domain(self, context, domain_id, values): domain = self.storage_conn.update_domain(context, domain_id, values) agent_api.update_domain(context, domain) utils.notify(context, 'api', 'domain.update', domain) return domain
def delete_server(self, context, server_id): policy.check('delete_server', context, {'server_id': server_id}) server = self.storage.get_server(context, server_id) utils.notify(context, 'central', 'server.delete', server) return self.storage.delete_server(context, server_id)
def update_server(self, context, server_id, values): policy.check('update_server', context, {'server_id': server_id}) server = self.storage.update_server(context, server_id, values) utils.notify(context, 'central', 'server.update', server) return server
def create_server(self, context, values): policy.check('create_server', context) server = self.storage.create_server(context, values) utils.notify(context, 'central', 'server.create', server) return server
def create_record(self, context, domain_id, values): record = self.storage_conn.create_record(context, domain_id, values) domain = self.storage_conn.get_domain(context, domain_id) agent_api.create_record(context, domain, record) utils.notify(context, 'api', 'record.create', record) return record
def delete_record(self, context, domain_id, record_id): record = self.storage_conn.get_record(context, record_id) domain = self.storage_conn.get_domain(context, domain_id) agent_api.delete_record(context, domain, record) utils.notify(context, 'api', 'record.delete', record) return self.storage_conn.delete_record(context, record_id)
def create_record(self, context, domain_id, values): record = self.storage_conn.create_record(context, domain_id, values) domain = self.storage_conn.get_domain(context, domain_id) agent_api.create_record(context, domain, record) utils.notify(context, "api", "record.create", record) return record
def update_record(self, context, domain_id, record_id, values): record = self.storage_conn.update_record(context, record_id, values) domain = self.storage_conn.get_domain(context, domain_id) agent_api.update_record(context, domain, record) utils.notify(context, 'api', 'record.update', record) return record
def delete_domain(self, context, domain_id): domain = self.storage_conn.get_domain(context, domain_id) target = {'domain_id': domain_id, 'tenant_id': domain['tenant_id']} policy.check('delete_domain', context, target) self.backend.delete_domain(context, domain) utils.notify(context, 'api', 'domain.delete', domain) return self.storage_conn.delete_domain(context, domain_id)
def create_record(self, context, domain_id, values): domain = self.storage_conn.get_domain(context, domain_id) target = {'domain_id': domain_id, 'tenant_id': domain['tenant_id']} policy.check('create_record', context, target) record = self.storage_conn.create_record(context, domain_id, values) self.backend.create_record(context, domain, record) utils.notify(context, 'api', 'record.create', record) return record
def create_domain(self, context, values): values['tenant_id'] = context.effective_tenant_id target = {'tenant_id': values['tenant_id']} policy.check('create_domain', context, target) # Ensure the domain does not end with a reserved suffix. self._check_reserved_domain_suffixes(context, values['name']) domain = self.storage_conn.create_domain(context, values) self.backend.create_domain(context, domain) utils.notify(context, 'api', 'domain.create', domain) return domain
def delete_record(self, context, domain_id, record_id): domain = self.storage_conn.get_domain(context, domain_id) target = { 'domain_id': domain_id, 'record_id': record_id, 'tenant_id': domain['tenant_id'] } policy.check('delete_record', context, target) record = self.storage_conn.get_record(context, record_id) self.backend.delete_record(context, domain, record) utils.notify(context, 'api', 'record.delete', record) return self.storage_conn.delete_record(context, record_id)
def touch_domain(self, context, domain_id): domain = self.storage.get_domain(context, domain_id) target = { 'domain_id': domain_id, 'domain_name': domain['name'], 'tenant_id': domain['tenant_id'] } policy.check('touch_domain', context, target) domain = self._increment_domain_serial(context, domain_id) utils.notify(context, 'central', 'domain.touch', domain) return domain
def update_domain(self, context, domain_id, values): domain = self.storage_conn.get_domain(context, domain_id) target = {'domain_id': domain_id, 'tenant_id': domain['tenant_id']} policy.check('update_domain', context, target) if 'tenant_id' in values: target = {'domain_id': domain_id, 'tenant_id': values['tenant_id']} policy.check('create_domain', context, target) if 'name' in values: # Ensure the domain does not end with a reserved suffix. self._check_reserved_domain_suffixes(context, values['name']) domain = self.storage_conn.update_domain(context, domain_id, values) self.backend.update_domain(context, domain) utils.notify(context, 'api', 'domain.update', domain) return domain
# TSIG Key Methods def create_tsigkey(self, context, values): policy.check('create_tsigkey', context) tsigkey = self.storage.create_tsigkey(context, values) try: self.backend.create_tsigkey(context, tsigkey) except exceptions.Backend: # Re-raise Backend exceptions as is.. raise except Exception, e: raise exceptions.Backend('Unknown backend failure: %s' % e) utils.notify(context, 'central', 'tsigkey.create', tsigkey) return tsigkey def get_tsigkeys(self, context, criterion=None): policy.check('get_tsigkeys', context) return self.storage.get_tsigkeys(context, criterion) def get_tsigkey(self, context, tsigkey_id): policy.check('get_tsigkey', context, {'tsigkey_id': tsigkey_id}) return self.storage.get_tsigkey(context, tsigkey_id) def update_tsigkey(self, context, tsigkey_id, values): policy.check('update_tsigkey', context, {'tsigkey_id': tsigkey_id})
def update_server(self, context, server_id, values): server = self.storage_conn.update_server(context, server_id, values) utils.notify(context, 'api', 'server.update', server) return server
def delete_server(self, context, server_id): server = self.storage_conn.get_server(context, server_id) utils.notify(context, 'api', 'server.delete', server) return self.storage_conn.delete_server(context, server_id)
def create_server(self, context, values): server = self.storage_conn.create_server(context, values) utils.notify(context, 'api', 'server.create', server) return server
def create_server(self, context, values): server = self.storage_conn.create_server(context, values) utils.notify(context, "api", "server.create", server) return server