-
Notifications
You must be signed in to change notification settings - Fork 220
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
added path_query_string parameter #112
added path_query_string parameter #112
Conversation
Thanks, @NamrathaG! |
Oh goodness - I've confused myself. Yep - this makes sense. Can you make just one modification, please, to name the parameter to |
@DRuggeri Is this good to go? |
@NamrathaG May I suggest you add the |
@sirlatrom I see data source already has an optional |
@NamrathaG How about the former, with the latter as an option for overriding in the cases when a different or an empty query string is required? |
Yes, that makes sense. Will update the PR. |
@sirlatrom In the above comment by empty you mean the user will explicitly set |
Yes, that would reflect how the provider otherwise builds reasonable default effective values for e.g. |
But then how to differentiate between the case
Is there a better way? |
I believe the Provider SDK has methods for knowing whether an argument is set. Maybe it's called |
The closest I could find was GetOk and GetOkExists, but both return |
I must have confused it with https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/terraform#ResourceConfig.IsSet, which I don't know if is available in the method you're implementing. |
The function (
|
@NamrathaG I recommend changing the type of the query_string field in the struct to PS: It will still be of the |
@sirlatrom But I don't understand how this solves our problem of identifying if |
@NamrathaG My bad, I meant the Additionally, if a map like query_string, query_string_exists := obj.read_search["read_query_string"]
if read_query_string_exists {
if obj.debug {
log.Printf("api_object.go: Adding read query string '%s'", obj.query_string)
}
query_string = fmt.Sprintf("%s&%s", obj.read_search["read_query_string"], obj.query_string)
} |
@sirlatrom I understood that if a variable's type is set to But I don't think setting I am assuming we are going to set the datasource schema as below
|
@NamrathaG The schema looks right. Use |
@sirlatrom Yeah, I tried this but getting the same output for both the cases below
Case 2:
When I run the below snippet for both the cases I am getting the same result( ok is
|
I think I finally get it now, sorry for taking so long 😅 So, in the docs it says
which means a string value of I think that means your suggestion of a placeholder default value is the best approach. |
Thanks for the awesome discussion, all. Much appreciated! I'm waiting for the day an issue gets logged where a user would like to set the query string of |
Issue : #103
Helps the user add a query string to API requests.