func ListDirectProperties()

in provider-schema/result.go [124:156]


func ListDirectProperties(objectName string, path string) ([]*schema.SchemaAttribute, error) {
	resource, exists := GetFinalTerraformObject()[objectName]
	if !exists {
		return nil, fmt.Errorf("resource/data source '%s' not found", objectName)
	}
	fields := resource.Fields

	if path != "" {
		block, err := NavigateToNestedBlock(objectName, path)
		if err != nil {
			return nil, err
		}

		if block == nil {
			return nil, fmt.Errorf("block '%s' not found in resource/data source '%s'", path, objectName)
		}

		fields = block.Fields
	}

	var properties []*schema.SchemaAttribute
	for _, property := range fields {
		if property.Computed {
			continue
		}

		properties = append(properties, property)
	}

	setSort(properties)

	return properties, nil
}