#NEWLINE# def __init__( self , data = None , name = None ) : #NEWLINE# #INDENT# '\n    Creates a new API instance using the provided input data. This constructor\n    takes two different arguments, but only one of them should be provided\n    at a time. The dictionary argument is useful for creating an API instance\n    from a given JSON description of the API. The other string argument is\n    useful when creating an API instance entirely programatically.\n\n    Args:\n      data  A dictionary containing all the required API attributes\n      name  Name of the API\n    ' #NEWLINE# self . name = None #NEWLINE# self . base = [ ] #NEWLINE# self . description = None #NEWLINE# self . version = None #NEWLINE# self . resources = [ ] #NEWLINE# self . data_types = [ ] #NEWLINE# self . ownership = [ ] #NEWLINE# self . sla = [ ] #NEWLINE# self . license = None #NEWLINE# self . categories = [ ] #NEWLINE# self . tags = [ ] #NEWLINE# self . security = None #NEWLINE# self . community = None #NEWLINE# if ( data is not None ) : #NEWLINE# #INDENT# if ( name is not None ) : #NEWLINE# #INDENT# raise APIDescriptionException ( 'name attribute must be None when the data field is provided' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# init_field ( self , data , NAME , True ) #NEWLINE# init_field ( self , data , DESCRIPTION ) #NEWLINE# init_field ( self , data , BASE ) #NEWLINE# init_field ( self , data , CATEGORIES ) #NEWLINE# init_field ( self , data , TAGS ) #NEWLINE# init_field ( self , data , LICENSE ) #NEWLINE# init_field ( self , data , COMMUNITY ) #NEWLINE# if data . has_key ( RESOURCES ) : #NEWLINE# #INDENT# for resource in data [ RESOURCES ] : #NEWLINE# #INDENT# self . resources . append ( Resource ( data = resource ) ) #NEWLINE# #UNINDENT# #UNINDENT# if data . has_key ( DATA_TYPES ) : #NEWLINE# #INDENT# for data_type in data [ DATA_TYPES ] : #NEWLINE# #INDENT# self . data_types . append ( NamedTypeDef ( data = data_type ) ) #NEWLINE# #UNINDENT# #UNINDENT# if data . has_key ( OWNERSHIP ) : #NEWLINE# #INDENT# for owner in data [ OWNERSHIP ] : #NEWLINE# #INDENT# self . ownership . append ( Owner ( data = owner ) ) #NEWLINE# #UNINDENT# #UNINDENT# if data . has_key ( SLA ) : #NEWLINE# #INDENT# for sla in data [ SLA ] : #NEWLINE# #INDENT# self . sla . append ( SLADef ( data = sla ) ) #NEWLINE# #UNINDENT# #UNINDENT# if data . has_key ( VERSION ) : #NEWLINE# #INDENT# self . version = Version ( data = data [ VERSION ] ) #NEWLINE# #UNINDENT# self . validate ( ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( name is None ) : #NEWLINE# #INDENT# raise APIDescriptionException ( 'name attribute must not be None when the data field is not provided' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . name = name