def create_api_model(restApiId, modelName, modelDescription, schema, contentType='application/json', region=None, key=None, keyid=None, profile=None):
 try:
  schema_json = (json.dumps(schema) if isinstance(schema, dict) else schema)
  conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
  model = conn.create_model(restApiId=restApiId, name=modelName, description=modelDescription, schema=schema_json, contentType=contentType)
  return {'created': True, 'model': _convert_datetime_str(model)}
 except ClientError as e:
  return {'created': False, 'error': salt.utils.boto3.get_error(e)}

def create_api_model ( restApiId , modelName , modelDescription , schema , contentType = 'application/json' , region = None , key = None , keyid = None , profile = None ) : try : schema_json = ( json . dumps ( schema ) if isinstance ( schema , dict ) else schema ) conn = _get_conn ( region = region , key = key , keyid = keyid , profile = profile ) model = conn . create_model ( restApiId = restApiId , name = modelName , description = modelDescription , schema = schema_json , contentType = contentType ) return { 'created' : True , 'model' : _convert_datetime_str ( model ) } except ClientError as e : return { 'created' : False , 'error' : salt . utils . boto3 . get_error ( e ) }
create a new model in a given api with a given schema .