apigee: add list resources for 5 resources with array-response or org-name mapping - #18478
apigee: add list resources for 5 resources with array-response or org-name mapping#18478BBBmau wants to merge 2 commits into
Conversation
Resources with no scope params (e.g. AddonsConfig) do not reference types.String and produced an 'imported and not used' compile error.
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 6ced62c: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 14 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the replaying VCR build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the recording VCR build log or the debug logs folder for detailed results. @BBBmau, @malhotrasagar2212 VCR tests complete for 6ced62c! |
Adds list-resource generation for 5 Apigee resources that require non-standard list machinery not present in the base
add-apigee-list-resourcesPR (#18432).What's included
New
list_response_is_arrayflag (resource.go,list_resource_method.go.tmpl)Two Apigee APIs return a bare JSON array instead of a wrapped object with a named key:
EnvironmentKeyvaluemaps—GET {{env_id}}/keyvaluemapsreturns["kvm1", "kvm2", ...]TargetServer—GET {{env_id}}/targetserversreturns[{...}, {...}]A new
list_response_is_array: trueYAML flag switches the generatedList*sfunction fromListPagesto the newListArrayPageshelper.New
ListArrayPagestransport helper (transport/transport.go)ListArrayPagesperforms aGETagainst a URL whose response body is a top-level JSON array. It mirrorsListPagesin structure (seed-state isolation, rate-limit retry,Flattener+Callback) but decodes[]interface{}directly instead of extracting a named key from a wrapper object.Custom
collection_url_keyand org-name decodersTwo resources share the
organizationslist endpoint but store the org identifier differently:AddonsConfig"organization"field;orgparam is never setapigee_addons_config.go.tmplcopiesres["organization"]→d.Set("org", …)Organization"organization"field; identity uses"name"apigee_organization.go.tmplcopiesres["organization"]→res["name"](no-op on direct reads wherenameis already set)AddonsConfigalso needed an explicitcollection_url_key: 'organizations'since the default camelization (addonsConfigs) does not match the API response key.ApiProductneededcollection_url_key: 'apiProduct'for the same reason (default would beapiProducts).list_resource.go.tmplimport guardThe
"github.com/hashicorp/terraform-plugin-framework/types"import was unconditionally emitted. Resources with no scope params (AddonsConfig,Organization) have an emptyListModelstruct and never referencetypes.String, producing a compile error. The import is now gated on{{- if $.ListScopeProperties }}.Resources added