Skip to content

transport: add Resource in ListCallOptions for refreshing resourceData in listPages#27467

Merged
modular-magician merged 1 commit into
hashicorp:mainfrom
modular-magician:downstream-pr-9147c861596cc0a8c36cb974191f3007de885f68
May 19, 2026
Merged

transport: add Resource in ListCallOptions for refreshing resourceData in listPages#27467
modular-magician merged 1 commit into
hashicorp:mainfrom
modular-magician:downstream-pr-9147c861596cc0a8c36cb974191f3007de885f68

Conversation

@modular-magician
Copy link
Copy Markdown
Collaborator

Release Note Template for Downstream PRs (will be copied)

When reviewing the following PR:

we run into an issue where the flatteners produced on the target handwritten resource do not overwrite all fields leading to failures on tests and the need to manually integrate the list call on the list resource itself instead of relying on the existing ListPages.

Resolving this would be introducing a refresh of the resourceData for every item that's in the list method response.

each item contains the seedResourceData which contains the list configure values that are set prior to the listPages call.

a new field in ListCallOptions is necessary in order to call the resource schema:

			seedState := opt.TempData.State() <-- new
			for _, item := range items {
				itemMap, ok := item.(map[string]interface{})
				if !ok {
					return fmt.Errorf("expected item to be map[string]interface{}, got %T", item)
				}

				itemResourceData := opt.Resource.Data(seedState) <-- new
				if err := opt.Flattener(itemMap, itemResourceData, opt.Config); err != nil {
					return fmt.Errorf("Error flattening instance: %s", err)
				}
				if err := opt.Callback(itemResourceData); err != nil {

See Write release notes for guidance.


Derived from GoogleCloudPlatform/magic-modules#17543

…rceData in listPages (hashicorp#17543)

[upstream:9147c861596cc0a8c36cb974191f3007de885f68]

Signed-off-by: Modular Magician <magic-modules@google.com>
@modular-magician modular-magician merged commit 5d9f133 into hashicorp:main May 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant