#NEWLINE# def create_datacenter( self , descriptor = None , descriptor_format = None , name = None , vim_url = None , **kwargs ) : #NEWLINE# #INDENT# "Creates a datacenter\n        Params: must supply a descriptor or/and just a name and vim_url\n            descriptor: with format {'datacenter':{new_datacenter_info}}\n                newdatacenter_info must contain 'name', 'vim_url', and optionally 'description'\n                must be a dictionary or a json/yaml text.\n            name: the datacenter name. Overwrite descriptor name if any\n            vim_url: the datacenter URL. Overwrite descriptor vim_url if any\n            vim_url_admin: the datacenter URL for administrative issues. Overwrite descriptor vim_url if any\n            vim_type: the datacenter type, can be openstack or openvim. Overwrite descriptor type if any\n            public: boolean, by default not public\n            description: datacenter description. Overwrite descriptor description if any\n            config: dictionary with extra configuration for the concrete datacenter\n        Return: Raises an exception on error\n                Obtain a dictionary with format {'datacenter':{new_datacenter_info}}\n        " #NEWLINE# if isinstance ( descriptor , str ) : #NEWLINE# #INDENT# descriptor = self . parse ( descriptor , descriptor_format ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if descriptor : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( name and vim_url ) : #NEWLINE# #INDENT# descriptor = { #NEWLINE# #INDENT# 'datacenter' : { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'vim_url' : vim_url , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise OpenmanoBadParamsException ( 'Missing descriptor, or name and vim_url' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( ( 'datacenter' not in descriptor ) or ( len ( descriptor ) != 1 ) ) : #NEWLINE# #INDENT# raise OpenmanoBadParamsException ( "Descriptor must contain only one 'datacenter' field" ) #NEWLINE# #UNINDENT# if name : #NEWLINE# #INDENT# descriptor [ 'datacenter' ] [ 'name' ] = descriptor #NEWLINE# #UNINDENT# if vim_url : #NEWLINE# #INDENT# descriptor [ 'datacenter' ] [ 'vim_url' ] = vim_url #NEWLINE# #UNINDENT# for param in kwargs : #NEWLINE# #INDENT# descriptor [ 'datacenter' ] [ param ] = kwargs [ param ] #NEWLINE# #UNINDENT# return self . _create_item ( 'datacenters' , descriptor , all_tenants = None )