Skip to content

apigee: add list resources for 5 resources with array-response or org-name mapping - #18478

Open
BBBmau wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
BBBmau:apigee-list-resources-ArrayResponse
Open

apigee: add list resources for 5 resources with array-response or org-name mapping#18478
BBBmau wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
BBBmau:apigee-list-resources-ArrayResponse

Conversation

@BBBmau

@BBBmau BBBmau commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Adds list-resource generation for 5 Apigee resources that require non-standard list machinery not present in the base add-apigee-list-resources PR (#18432).

What's included

New list_response_is_array flag (resource.go, list_resource_method.go.tmpl)

Two Apigee APIs return a bare JSON array instead of a wrapped object with a named key:

  • EnvironmentKeyvaluemapsGET {{env_id}}/keyvaluemaps returns ["kvm1", "kvm2", ...]
  • TargetServerGET {{env_id}}/targetservers returns [{...}, {...}]

A new list_response_is_array: true YAML flag switches the generated List*s function from ListPages to the new ListArrayPages helper.

New ListArrayPages transport helper (transport/transport.go)

ListArrayPages performs a GET against a URL whose response body is a top-level JSON array. It mirrors ListPages in 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_key and org-name decoders

Two resources share the organizations list endpoint but store the org identifier differently:

Resource Problem Fix
AddonsConfig List items have "organization" field; org param is never set New decoder apigee_addons_config.go.tmpl copies res["organization"]d.Set("org", …)
Organization List items have "organization" field; identity uses "name" New decoder apigee_organization.go.tmpl copies res["organization"]res["name"] (no-op on direct reads where name is already set)

AddonsConfig also needed an explicit collection_url_key: 'organizations' since the default camelization (addonsConfigs) does not match the API response key.

ApiProduct needed collection_url_key: 'apiProduct' for the same reason (default would be apiProducts).

list_resource.go.tmpl import guard

The "github.com/hashicorp/terraform-plugin-framework/types" import was unconditionally emitted. Resources with no scope params (AddonsConfig, Organization) have an empty ListModel struct and never reference types.String, producing a compile error. The import is now gated on {{- if $.ListScopeProperties }}.

Resources added

`google_apigee_addons_config`
`google_apigee_api_product`
`google_apigee_environment_keyvaluemaps`
`google_apigee_organization`
`google_apigee_target_server`

BBBmau added 2 commits July 30, 2026 14:22
Resources with no scope params (e.g. AddonsConfig) do not reference
types.String and produced an 'imported and not used' compile error.
@modular-magician

modular-magician commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 6ced62c:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 82 files changed, 1434 insertions(+), 68 deletions(-)
google-beta provider View Diff 85 files changed, 1434 insertions(+), 71 deletions(-)
terraform-google-conversion View Diff 1 file changed, 90 insertions(+)

Test report

Analytics

Total Tests Passed Skipped Affected
6878 6158 706 14
Affected Service Packages
  • All service packages are affected

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 14 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccApigeeAddonsConfigListQuery_generated
  • TestAccApigeeApiProductListQuery_generated
  • TestAccApigeeEnvironmentKeyvaluemapsListQuery_generated
  • TestAccApigeeTargetServerListQuery_generated
  • TestAccComputeInstanceFromMachineImage_diffProject
  • TestAccComputeSecurityPolicy_withPreconfiguredWafConfig
  • TestAccDataformConfig_update
  • TestAccDataprocMetastoreService_dataprocMetastoreServicePrivateServiceConnectExample
  • TestAccDiscoveryEngineDataStore_discoveryengineDatastoreKmsKeyNameExample
  • TestAccManagedKafkaConnector_managedkafkaConnectorBasicExample
  • TestAccPubsubSubscription_pubsubSubscriptionTagsExample
  • TestAccVertexAIFeatureOnlineStoreFeatureviewIamBindingGenerated
  • TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_featureRegistry_updated
  • TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_updated

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
✅ Log TestAccApigeeAddonsConfigListQuery_generated
✅ Log TestAccVertexAIFeatureOnlineStoreFeatureviewIamBindingGenerated
✅ Log TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_updated
❌ Error · Log - TestAccApigeeApiProductListQuery_generated
❌ Error · Log - TestAccApigeeEnvironmentKeyvaluemapsListQuery_generated
❌ Error · Log - TestAccApigeeTargetServerListQuery_generated
❌ Error · Log - TestAccComputeInstanceFromMachineImage_diffProject
❌ Error · Log - TestAccComputeSecurityPolicy_withPreconfiguredWafConfig
❌ Error · Log - TestAccDataformConfig_update
❌ Error · Log - TestAccDataprocMetastoreService_dataprocMetastoreServicePrivateServiceConnectExample
❌ Error · Log - TestAccDiscoveryEngineDataStore_discoveryengineDatastoreKmsKeyNameExample
❌ Error · Log - TestAccManagedKafkaConnector_managedkafkaConnectorBasicExample
❌ Error · Log - TestAccPubsubSubscription_pubsubSubscriptionTagsExample
❌ Error · Log - TestAccVertexAIFeatureOnlineStoreFeatureview_vertexAiFeatureonlinestoreFeatureview_featureRegistry_updated

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants