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

[REQ] Improve intersight_search_search_item #174

Open
jerewill-cisco opened this issue Feb 22, 2022 · 1 comment
Open

[REQ] Improve intersight_search_search_item #174

jerewill-cisco opened this issue Feb 22, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@jerewill-cisco
Copy link
Contributor

jerewill-cisco commented Feb 22, 2022

The Issue

The current syntax for the intersight_search_search_item data source (which is also poorly documented) essentially allows us to insert positive (i.e. eq) searches for attributes, such as this...

data "intersight_search_search_item" "example_by_model" {
  additional_properties = jsonencode({ "Model" = "UCSC-C220-M5SX"})
}

But not a simple negative (i.e. ne) searches for attributes. More complex searches are not supported in a direct way.

Although it's possible to hack the attribute packing to create a more complex search as long as your search includes at least one positive element like this... (it's essentially an injection attack, which IMO should also be 'fixed' as a part of this request)

data "intersight_search_search_item" "example_exclude_model" {
  additional_properties = jsonencode({ "Presence" = "equipped' and Model ne 'UCSC-C220-M5SX"})
}

or

data "intersight_search_search_item" "os_linux" {
  additional_properties = jsonencode({ "Presence" = "equipped' and Tags/any(t:t/Key eq 'os' and t/Value eq 'linux') and ObjectType eq 'compute.PhysicalSummary" })
}

Really complex syntax is completely out of reach.

Proposed Solution

The data source should accept the standard set of parameters as an array. Syntax should appear similar to this...

data "intersight_search_search_item" "os_linux" {
    odata {
        filter = "ObjectType ne 'compute.PhysicalSummary' and Tags/any(t:t/Key eq 'os' and t/Value eq 'linux')"
        select = "BiosUnits,Model,Serial"
        top = "2"
        expand = "BiosUnits($select=RunningFirmware%3b$expand=RunningFirmware($select=PackageVersion))"
    }
}

This would provide a much more obvious and expressive syntax as well as access to the complex search capabilities that are available in Intersight.

@briamorr
Copy link

I agree with the format of the proposed solution, it aligns with the API documentation and would make the data source simpler to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants