def on_post(self, req, resp, keystone_id): LOG.debug('Start on_post for tenant-ID {0}:...'.format(keystone_id)) data = api.load_body(req, resp, self.validator) tenant = res.get_or_create_tenant(keystone_id, self.tenant_repo) try: new_secret = res.create_secret(data, tenant, self.crypto_manager, self.secret_repo, self.tenant_secret_repo, self.datum_repo) except em.CryptoMimeTypeNotSupportedException as cmtnse: LOG.exception('Secret creation failed - mime-type not supported') _secret_mime_type_not_supported(cmtnse.mime_type, req, resp) except exception.NoDataToProcess: LOG.exception('No secret data to process') _secret_plain_text_empty(req, resp) except exception.LimitExceeded: LOG.exception('Secret data too big to process') _secret_data_too_large(req, resp) except Exception as e: LOG.exception('Secret creation failed - unknown') _general_failure('Secret creation failed - unknown', req, resp) resp.status = falcon.HTTP_201 resp.set_header('Location', '/{0}/secrets/{1}'.format(keystone_id, new_secret.id)) url = convert_secret_to_href(keystone_id, new_secret.id) LOG.debug('URI to secret is {0}'.format(url)) resp.body = json.dumps({'secret_ref': url})
def handle_order(self, order): """Handle secret creation. Either creates a secret item here, or else begins the extended process of creating a secret (such as for SSL certificate generation. :param order: Order to process on behalf of. """ order_info = order.to_dict_fields() secret_info = order_info["secret"] # Retrieve the tenant. tenant = self.tenant_repo.get(order.tenant_id) # Create Secret new_secret = res.create_secret( secret_info, tenant, self.crypto_manager, self.secret_repo, self.tenant_secret_repo, self.datum_repo, self.kek_repo, ok_to_generate=True, ) order.secret_id = new_secret.id LOG.debug("...done creating order's secret.")
def handle_order(self, order): """Handle secret creation. Either creates a secret item here, or else begins the extended process of creating a secret (such as for SSL certificate generation. :param order: Order to process on behalf of. """ order_info = order.to_dict_fields() secret_info = order_info['secret'] # Retrieve the tenant. tenant = self.tenant_repo.get(order.tenant_id) # Create Secret new_secret = res.create_secret(secret_info, tenant, self.crypto_manager, self.secret_repo, self.tenant_secret_repo, self.datum_repo, self.kek_repo, ok_to_generate=True) order.secret_id = new_secret.id LOG.debug("...done creating order's secret.")
def on_post(self, req, resp, tenant_id): LOG.debug('Start on_post for tenant-ID {0}:'.format(tenant_id)) data = load_body(req) tenant = get_or_create_tenant(tenant_id, self.tenant_repo) new_secret = create_secret(data, tenant, self.crypto_manager, self.secret_repo, self.tenant_secret_repo, self.datum_repo) resp.status = falcon.HTTP_202 resp.set_header('Location', '/{0}/secrets/{1}'.format(tenant_id, new_secret.id)) url = convert_secret_to_href(tenant_id, new_secret.id) LOG.debug('URI to secret is {0}'.format(url)) resp.body = json.dumps({'secret_ref': url})
def on_post(self, req, resp, keystone_id): LOG.debug('Start on_post for tenant-ID {0}:...'.format(keystone_id)) data = api.load_body(req, resp, self.validator) tenant = res.get_or_create_tenant(keystone_id, self.tenant_repo) new_secret = res.create_secret(data, tenant, self.crypto_manager, self.secret_repo, self.tenant_secret_repo, self.datum_repo, self.kek_repo) resp.status = falcon.HTTP_201 resp.set_header('Location', '/{0}/secrets/{1}'.format(keystone_id, new_secret.id)) url = convert_secret_to_href(keystone_id, new_secret.id) LOG.debug('URI to secret is {0}'.format(url)) resp.body = json.dumps({'secret_ref': url})
def on_post(self, keystone_id, **kwargs): LOG.debug('Start on_post for tenant-ID {0}:...'.format(keystone_id)) data = api.load_body(pecan.request, validator=self.validator) tenant = res.get_or_create_tenant(keystone_id, self.tenant_repo) new_secret = res.create_secret(data, tenant, self.crypto_manager, self.secret_repo, self.tenant_secret_repo, self.datum_repo, self.kek_repo) pecan.response.status = 201 pecan.response.headers['Location'] = '/{0}/secrets/{1}'.format( keystone_id, new_secret.id ) url = hrefs.convert_secret_to_href(keystone_id, new_secret.id) LOG.debug('URI to secret is {0}'.format(url)) return {'secret_ref': url}
def on_post(self, keystone_id): LOG.debug('Start on_post for tenant-ID {0}:...'.format(keystone_id)) data = api.load_body(pecan.request, validator=self.validator) tenant = res.get_or_create_tenant(keystone_id, self.tenant_repo) new_secret = res.create_secret(data, tenant, self.crypto_manager, self.secret_repo, self.tenant_secret_repo, self.datum_repo, self.kek_repo) pecan.response.status = 201 pecan.response.headers['Location'] = '/{0}/secrets/{1}'.format( keystone_id, new_secret.id ) url = hrefs.convert_secret_to_href(keystone_id, new_secret.id) LOG.debug('URI to secret is {0}'.format(url)) return {'secret_ref': url}
def _handle_order(self, order): """ Either creates a secret item here, or else begins the extended process of creating a secret (such as for SSL certificate generation. """ LOG.debug("Handling order for secret type of {0}..." .format(order.secret_mime_type)) order_info = order.to_dict_fields() secret_info = order_info['secret'] # Create Secret tenant = get_or_create_tenant(order.tenant_id, self.tenant_repo) new_secret = create_secret(secret_info, tenant, self.crypto_manager, self.secret_repo, self.tenant_secret_repo, self.datum_repo, ok_to_generate=True) order.secret_id = new_secret.id LOG.debug("...done creating order's secret.")
def _handle_order(self, order): """ Either creates a secret item here, or else begins the extended process of creating a secret (such as for SSL certificate generation. """ LOG.debug("Handling order for secret type of {0}..." .format(order.secret_mime_type)) order_info = order.to_dict_fields() secret_info = order_info['secret'] # Retrieve the tenant. tenant = self.tenant_repo.get(order.tenant_id) # Create Secret new_secret = create_secret(secret_info, tenant, self.crypto_manager, self.secret_repo, self.tenant_secret_repo, self.datum_repo, ok_to_generate=True) order.secret_id = new_secret.id LOG.debug("...done creating order's secret.")