@webob.dec.wsgify
@microversion.version_handler(1.2)
@util.require_content('application/json')
def create_resource_class(req):
 context = req.environ['placement.context']
 data = util.extract_json(req.body, POST_RC_SCHEMA_V1_2)
 try:
  rc = objects.ResourceClass(context, name=data['name'])
  rc.create()
 except exception.ResourceClassExists:
  raise webob.exc.HTTPConflict((_('Conflicting resource class already exists: %(name)s') % {'name': data['name']}), json_formatter=util.json_error_formatter)
 req.response.location = util.resource_class_url(req.environ, rc)
 req.response.status = 201
 req.response.content_type = None
 return req.response

@ webob . dec . wsgify @ microversion . version_handler ( 1.2 ) @ util . require_content ( 'application/json' ) def create_resource_class ( req ) : context = req . environ [ 'placement.context' ] data = util . extract_json ( req . body , POST_RC_SCHEMA_V1_2 ) try : rc = objects . ResourceClass ( context , name = data [ 'name' ] ) rc . create ( ) except exception . ResourceClassExists : raise webob . exc . HTTPConflict ( ( _ ( 'Conflicting resource class already exists: %(name)s' ) % { 'name' : data [ 'name' ] } ) , json_formatter = util . json_error_formatter ) req . response . location = util . resource_class_url ( req . environ , rc ) req . response . status = 201 req . response . content_type = None return req . response
post to create a resource class .