gateways¶
Pydantic models/schemas for the Gateways resource.
GatewayCreate
¶
Bases: EntryResourceCreate
, GatewayResourceAttributes
Model for creating new Gateway resources in the MongoDB
Source code in optimade_gateway/models/gateways.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
database_ids: Optional[Set[str]] = Field(None, description='A unique list of database IDs for registered databases.')
class-attribute
¶
databases: Optional[List[LinksResource]]
class-attribute
¶
id: Optional[str] = OptimadeField(None, description='An entry\'s ID as defined in section Definition of Terms.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter\n features.\n - **Response**: REQUIRED in the response.\n - **Gateway-specific**: MUST NOT contain a forward slash (`/`).\n\n- **Examples**:\n - `"db_1234567"`\n - `"cod_2000000"`\n - `"cod_2000000@1234567"`\n - `"nomad_L1234567890"`\n - `"42"`', support=SupportLevel.MUST, queryable=SupportLevel.MUST, regex='^[^/]*$')
class-attribute
¶
specify_databases(values)
¶
Either database_ids
or databases
must be non-empty.
Both together is also fine.
Source code in optimade_gateway/models/gateways.py
145 146 147 148 149 150 151 152 |
|
GatewayResource
¶
Bases: EntryResource
OPTIMADE gateway
A resource representing a dynamic collection of OPTIMADE databases.
The gateway can be treated as any other OPTIMADE gateway, but the entries are an
aggregate of multiple databases. The id
of each aggregated resource will reflect
the originating database.
Source code in optimade_gateway/models/gateways.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
attributes: GatewayResourceAttributes
class-attribute
¶
id: str = OptimadeField(Ellipsis, description='An entry\'s ID as defined in section Definition of Terms.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter\n features.\n - **Response**: REQUIRED in the response.\n - **Gateway-specific**: MUST NOT contain a forward slash (`/`).\n\n- **Examples**:\n - `"db_1234567"`\n - `"cod_2000000"`\n - `"cod_2000000@1234567"`\n - `"nomad_L1234567890"`\n - `"42"`', support=SupportLevel.MUST, queryable=SupportLevel.MUST, regex='^[^/]*$')
class-attribute
¶
type: str = Field('gateways', const=True, description='The name of the type of an entry.', regex='^gateways$')
class-attribute
¶
GatewayResourceAttributes
¶
Bases: EntryResourceAttributes
Attributes for an OPTIMADE gateway
Source code in optimade_gateway/models/gateways.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
databases: List[LinksResource] = Field(Ellipsis, description="List of databases (OPTIMADE 'links') to be queried in this gateway.")
class-attribute
¶
no_index_databases(value)
¶
Ensure databases are not of type "root"
or "providers"
Note
Both "external"
and "child"
can still represent index meta-dbs,
but "root"
and "providers"
can not represent "regular" dbs.
Source code in optimade_gateway/models/gateways.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
unique_base_urls(value)
¶
Remove extra entries with repeated base_urls
Source code in optimade_gateway/models/gateways.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|