<commit_before>config := meta.(*Config)

// current import_formats can't import fields with forward slashes in their value
if err := parseImportId([]string{"(?P<name>.+)"}, d, config); err != nil {
	return nil, err
}

parts := strings.Split(d.Get("name").(string), "/")

var projectId string
switch len(parts) {
	case 1:
		projectId = parts[0]
	case 2:
		projectId = parts[1]
	default:
		return nil, fmt.Errorf(
			"Saw %s when the name is expected to have shape %s or %s",
			d.Get("name"),
			"{{name}}",
			"organizations/{{name}}",
		)
}

if err := d.Set("name", projectId); err != nil {
	return nil, fmt.Errorf("Error setting organization: %s", err)
}

if err := d.Set("project_id", projectId); err != nil {
	return nil, fmt.Errorf("Error setting organization: %s", err)
}
return []*schema.ResourceData{d}, nil<commit_msg>fix apigee org import (#4497)<commit_after>config := meta.(*Config)

// current import_formats can't import fields with forward slashes in their value
if err := parseImportId([]string{"(?P<name>.+)"}, d, config); err != nil {
	return nil, err
}

parts := strings.Split(d.Get("name").(string), "/")

var projectId string
switch len(parts) {
	case 1:
		projectId = parts[0]
	case 2:
		projectId = parts[1]
	default:
		return nil, fmt.Errorf(
			"Saw %s when the name is expected to have shape %s or %s",
			d.Get("name"),
			"{{name}}",
			"organizations/{{name}}",
		)
}

if err := d.Set("name", projectId); err != nil {
	return nil, fmt.Errorf("Error setting organization: %s", err)
}

if err := d.Set("project_id", projectId); err != nil {
	return nil, fmt.Errorf("Error setting organization: %s", err)
}

// Replace import id for the resource id
id, err := replaceVars(d, config, "organizations/{{name}}")
if err != nil {
	return nil, fmt.Errorf("Error constructing id: %s", err)
}
d.SetId(id)

return []*schema.ResourceData{d}, nil
{'fraction_non_alphanumeric': 0.17893605588393338, 'fraction_numerical': 0.006448146157979581, 'mean_word_length': 4.335243553008596, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4740223', 'n_tokens_mistral': 676, 'n_tokens_neox': 636, 'n_words': 200}