22
33from openstackquery .aliases import QueryChainMappings
44from openstackquery .enums .props .image_properties import ImageProperties
5+ from openstackquery .enums .props .project_properties import ProjectProperties
56from openstackquery .enums .props .server_properties import ServerProperties
67from openstackquery .enums .query_presets import QueryPresets
78from openstackquery .handlers .client_side_handler import ClientSideHandler
@@ -23,7 +24,10 @@ def get_chain_mappings() -> QueryChainMappings:
2324 Return a dictionary containing property pairs mapped to query mappings.
2425 This is used to define how to chain results from this query to other possible queries
2526 """
26- return {ImageProperties .IMAGE_ID : [ServerProperties .IMAGE_ID ]}
27+ return {
28+ ImageProperties .IMAGE_ID : [ServerProperties .IMAGE_ID ],
29+ ImageProperties .IMAGE_OWNER : [ProjectProperties .PROJECT_ID ],
30+ }
2731
2832 @staticmethod
2933 def get_runner_mapping () -> Type [ImageRunner ]:
@@ -54,6 +58,7 @@ def get_server_side_handler() -> ServerSideHandler:
5458 QueryPresets .EQUAL_TO : {
5559 ImageProperties .IMAGE_NAME : lambda value : {"name" : value },
5660 ImageProperties .IMAGE_STATUS : lambda value : {"status" : value },
61+ ImageProperties .IMAGE_OWNER : lambda value : {"owner" : value },
5762 },
5863 QueryPresets .ANY_IN : {
5964 ImageProperties .IMAGE_NAME : lambda values : [
@@ -62,6 +67,9 @@ def get_server_side_handler() -> ServerSideHandler:
6267 ImageProperties .IMAGE_STATUS : lambda values : [
6368 {"status" : value } for value in values
6469 ],
70+ ImageProperties .IMAGE_OWNER : lambda values : [
71+ {"owner" : value } for value in values
72+ ],
6573 },
6674 QueryPresets .OLDER_THAN : {
6775 ImageProperties .IMAGE_CREATION_DATE : lambda func = TimeUtils .convert_to_timestamp , ** kwargs : {
@@ -127,8 +135,14 @@ def get_client_side_handler() -> ClientSideHandler:
127135 QueryPresets .NOT_EQUAL_TO : ["*" ],
128136 QueryPresets .ANY_IN : ["*" ],
129137 QueryPresets .NOT_ANY_IN : ["*" ],
130- QueryPresets .MATCHES_REGEX : [ImageProperties .IMAGE_NAME ],
131- QueryPresets .NOT_MATCHES_REGEX : [ImageProperties .IMAGE_NAME ],
138+ QueryPresets .MATCHES_REGEX : [
139+ ImageProperties .IMAGE_NAME ,
140+ ImageProperties .IMAGE_METADATA ,
141+ ],
142+ QueryPresets .NOT_MATCHES_REGEX : [
143+ ImageProperties .IMAGE_NAME ,
144+ ImageProperties .IMAGE_METADATA ,
145+ ],
132146 QueryPresets .YOUNGER_THAN : date_prop_list ,
133147 QueryPresets .YOUNGER_THAN_OR_EQUAL_TO : date_prop_list ,
134148 QueryPresets .OLDER_THAN : date_prop_list ,
0 commit comments