INNER CODE UNIT · Go
updateStateWithPayloadData
dikhan/terraform-provider-openapi · openapi/common.go:105
func updateStateWithPayloadData(openAPIResource SpecResource, remoteData map[string]interface{}, resourceLocalData *schema.ResourceData) error {
return updateStateWithPayloadDataAndOptions(openAPIResource, remoteData, resourceLocalData, true)
}
// dataSourceUpdateStateWithPayloadData is in charge of saving the given payload into the state file keeping for list properties the
// same order received by the API. The property names are converted into compliant terraform names if needed.
func dataSourceUpdateStateWithPayloadData(openAPIResource SpecResource, remoteData map[string]interface{}, resourceLocalData *schema.ResourceData) error {
return updateStateWithPayloadDataAndOptions(openAPIResource, remoteData, resourceLocalData, false)
}
// updateStateWithPayloadDataAndOptions is in charge of saving the given payload into the state file AND if the ignoreListOrder is enabled
// it will go ahead and compare the items in the list (input vs remote) for properties of type list and the flag 'IgnoreItemsOrder' set to true
// The property names are converted into compliant terraform names if needed.
func updateStateWithPayloadDataAndOptions(openAPIResource SpecResource, remoteData map[string]interface{}, resourceLocalData *schema.ResourceData, ignoreListOrderEnabled bool) error {
resourceSchema, err := openAPIResource.GetResourceSchema()
if err != nil {
return err
}