Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: add image search actions #277

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
153 changes: 153 additions & 0 deletions actions/image.search.by.datetime.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
---
description: Query images based on a datetime property (e.g. created-at or last-updated)
enabled: true
entry_point: src/openstack_actions.py
name: image.search.by.datetime
parameters:
timeout:
default: 5400
lib_entry_point:
default: workflows.search_by_datetime.search_by_datetime
immutable: true
type: string
query_type:
default: ImageQuery
immutable: true
type: string
as_admin:
default: True
immutable: true
type: boolean
cloud_account:
description: "The clouds.yaml account to use whilst performing this action"
required: true
type: string
default: "dev"
enum:
- "dev"
- "prod"
properties_to_select:
default:
- "image_creation_date"
- "image_creation_progress"
- "image_id"
- "image_last_updated_date"
- "image_minimum_ram"
- "image_minimum_disk"
- "image_name"
- "image_size"
- "image_status"
type: array
description: "
A comma-spaced list of image properties to display for the resulting images - leave empty for all properties. One of:
- 'image_creation_date'
- 'image_creation_progress'
- 'image_id'
- 'image_last_updated_date'
- 'image_minimum_ram'
- 'image_minimum_disk'
- 'image_name'
- 'image_size'
- 'image_status'
Anything else will raise an error"
required: false
output_type:
default: "to_string"
type: string
enum:
- "to_html"
- "to_objects"
- "to_props"
- "to_string"
description: "
A string representing how to return the results of the query
- 'to_html' - a tabulate table (in html)
- 'to_props' - properties dicts as a python list
- 'to_objects - as a list of openstack resources
- 'to_string' - a tabulate table"
required: true
property_to_search_by:
description: "choose datetime property to base the query on"
default: "image_creation_date"
type: string
required: true
enum:
- "image_creation_date"
- "image_last_updated_date"
search_mode:
description: "what to mode to use to search by"
default: "older_than"
type: string
required: true
enum:
- "older_than"
- "older_than_or_equal_to"
- "younger_than"
- "younger_than_or_equal_to"
days:
description: "(Optional) Number of relative days from now"
type: integer
default: 0
required: false
hours:
description: "(Optional) Number of relative hours from now"
type: integer
default: 0
required: false
minutes:
description: "(Optional) Number of relative minutes from now"
type: integer
default: 0
required: false
seconds:
description: "(Optional) Number of relative seconds from now"
type: integer
default: 0
required: false
from_projects:
description: "(Optional) comma-spaced list of projects id/names to limit query to, if not provided, runs against all projects"
type: array
default: null
required: false
all_projects:
type: boolean
description: "tick to search in all projects - default True"
required: true
default: true
Comment on lines +107 to +116
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anish-mudaraddi Is all_projects needed if when from_projects is not provided it runs against all projects?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On this if from_projects and all_projects are false the it will default to searching the admin project

Might be worth changing the from_projects description to something along the lines of: (Optional) comma-spaced list of projects id/names to limit query to, if not provided, runs against all projects when all_projects is true

group_by:
description: "(Optional) image property to group unique results by"
type: string
required: false
default: null
enum:
- null
- "image_creation_date"
- "image_creation_progress"
- "image_last_updated_date"
- "image_minimum_ram"
- "image_minimum_disk"
- "image_size"
- "image_status"
sort_by:
description: "(Optional) comma-spaced list of image properties to sort by (by ascending only)
- multiple of the same property will be ignored.
Any of:
- 'image_creation_date'
- 'image_creation_progress'
- 'image_id'
- 'image_last_updated_date'
- 'image_minimum_ram'
- 'image_minimum_disk'
- 'image_name'
- 'image_size'
- 'image_status'
Anything else will raise an error"
type: array
required: false
default: null
webhook:
description: "Optional string representing a stackstorm webhook url path, can't be used alongside group_by"
default: null
type: string
required: false
runner_type: python-script
139 changes: 139 additions & 0 deletions actions/image.search.by.expression.yaml
Neonbluestoplight marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
description: Search for images with a selected expression
enabled: true
entry_point: src/openstack_actions.py
name: image.search.by.expression
parameters:
timeout:
default: 5400
lib_entry_point:
default: workflows.search_by_expression.search_by_expression
immutable: true
type: string
query_type:
default: ImageQuery
immutable: true
type: string
as_admin:
default: True
immutable: true
type: boolean
cloud_account:
description: The clouds.yaml account to use whilst performing this action
required: true
type: string
default: "dev"
enum:
- "dev"
- "prod"
output_type:
default: "to_string"
type: string
enum:
- "to_html"
- "to_objects"
- "to_props"
- "to_string"
description: "
A string representing how to return the results of the query
- 'to_html' - a tabulate table (in html)
- 'to_props' - properties dicts as a python list
- 'to_objects - as a list of openstack resources
- 'to_string' - a tabulate table"
required: true
property_to_search_by:
default: "image_creation_progress"
description: "choose property to search by (acts as OR for each)"
enum:
- "image_creation_progress"
- "image_minimum_ram"
- "image_minimum_disk"
- "image_size"
type: string
required: true
search_mode:
description: "what to mode to use to search by"
default: "LESS_THAN"
type: string
required: true
enum:
- "LESS_THAN"
- "LESS_THAN_OR_EQUAL_TO"
- "GREATER_THAN"
- "GREATER_THAN_OR_EQUAL_TO"
value:
description: "A number to compare the property against"
required: true
type: integer
properties_to_select:
default:
- "image_creation_date"
- "image_creation_progress"
- "image_id"
- "image_last_updated_date"
- "image_minimum_ram"
- "image_minimum_disk"
- "image_name"
- "image_size"
- "image_status"
type: array
description: "
A comma-spaced list of image properties to display for the resulting images - leave empty for all properties. One of:
- 'image_creation_date'
- 'image_creation_progress'
- 'image_id'
- 'image_last_updated_date'
- 'image_minimum_ram'
- 'image_minimum_disk'
- 'image_name'
- 'image_size'
- 'image_status'
Anything else will raise an error"
required: false
from_projects:
description: "(Optional) comma-spaced list of projects id/names to limit query to, if not provided, runs against all projects"
type: array
default: null
required: false
all_projects:
type: boolean
description: "tick to search in all projects - default True"
required: true
default: true
group_by:
description: "(Optional) image property to group unique results by"
type: string
required: false
default: null
enum:
- null
- "image_creation_date"
- "image_creation_progress"
- "image_last_updated_date"
- "image_minimum_ram"
- "image_minimum_disk"
- "image_size"
- "image_status"
sort_by:
description: "(Optional) comma-spaced list of image properties to sort by (by ascending only)
- multiple of the same property will be ignored.
Any of:
- 'image_creation_date'
- 'image_creation_progress'
- 'image_id'
- 'image_last_updated_date'
- 'image_minimum_ram'
- 'image_minimum_disk'
- 'image_name'
- 'image_size'
- 'image_status'
Anything else will raise an error"
type: array
required: false
default: null
webhook:
description: "Optional string representing a stackstorm webhook url path, can't be used alongside group_by"
default: null
type: string
required: false
runner_type: python-script
Loading