def image_create(name, location=None, profile=None, visibility=None, container_format='bare', disk_format='raw', protected=None):
 kwargs = {}
 v_list = ['public', 'private']
 cf_list = ['ami', 'ari', 'aki', 'bare', 'ovf']
 df_list = ['ami', 'ari', 'aki', 'vhd', 'vmdk', 'raw', 'qcow2', 'vdi', 'iso']
 kwargs['copy_from'] = location
 if (visibility is not None):
  if (visibility not in v_list):
   raise SaltInvocationError(('"visibility" needs to be one ' + 'of the following: {0}'.format(', '.join(v_list))))
  elif (visibility == 'public'):
   kwargs['is_public'] = True
  else:
   kwargs['is_public'] = False
 else:
  kwargs['is_public'] = True
 if (container_format not in cf_list):
  raise SaltInvocationError(('"container_format" needs to be ' + 'one of the following: {0}'.format(', '.join(cf_list))))
 else:
  kwargs['container_format'] = container_format
 if (disk_format not in df_list):
  raise SaltInvocationError(('"disk_format" needs to be one ' + 'of the following: {0}'.format(', '.join(df_list))))
 else:
  kwargs['disk_format'] = disk_format
 if (protected is not None):
  kwargs['protected'] = protected
 g_client = _auth(profile, api_version=1)
 image = g_client.images.create(name=name, **kwargs)
 return image_show(image.id, profile=profile)

def image_create ( name , location = None , profile = None , visibility = None , container_format = 'bare' , disk_format = 'raw' , protected = None ) : kwargs = { } v_list = [ 'public' , 'private' ] cf_list = [ 'ami' , 'ari' , 'aki' , 'bare' , 'ovf' ] df_list = [ 'ami' , 'ari' , 'aki' , 'vhd' , 'vmdk' , 'raw' , 'qcow2' , 'vdi' , 'iso' ] kwargs [ 'copy_from' ] = location if ( visibility is not None ) : if ( visibility not in v_list ) : raise SaltInvocationError ( ( '"visibility" needs to be one ' + 'of the following: {0}' . format ( ', ' . join ( v_list ) ) ) ) elif ( visibility == 'public' ) : kwargs [ 'is_public' ] = True else : kwargs [ 'is_public' ] = False else : kwargs [ 'is_public' ] = True if ( container_format not in cf_list ) : raise SaltInvocationError ( ( '"container_format" needs to be ' + 'one of the following: {0}' . format ( ', ' . join ( cf_list ) ) ) ) else : kwargs [ 'container_format' ] = container_format if ( disk_format not in df_list ) : raise SaltInvocationError ( ( '"disk_format" needs to be one ' + 'of the following: {0}' . format ( ', ' . join ( df_list ) ) ) ) else : kwargs [ 'disk_format' ] = disk_format if ( protected is not None ) : kwargs [ 'protected' ] = protected g_client = _auth ( profile , api_version = 1 ) image = g_client . images . create ( name = name , ** kwargs ) return image_show ( image . id , profile = profile )
create an image from the values dictionary .