func parseArn(arn string) *Arn {
	sections := strings.Split(arn, ":")

	result := &Arn{
		ARN:          sections[0],
		Partition:    sections[1],
		Service:      sections[2],
		Region:       sections[3],
		AccountID:    sections[4],
		ResourcePath: "",
	}

	if n := strings.Count(sections[5], ":"); n > 0 {
		parts := strings.Split(sections[5], ":")
		result.ResourceType = parts[0]
		result.ResourceID = parts[1]
	} else {
		slashes := strings.Count(sections[5], "/")
		if slashes == 0 {
			result.ResourceID = sections[5]
		} else {
			parts := strings.Split(sections[5], "/")
			result.ResourceType = parts[0]
			result.ResourceID = parts[1]
			result.ResourcePath = strings.Join(parts[2:], "/")
		}
	}
	return result
}
// parseArn is decomposess ARN
// into components accordingly to ARN Format
parseArn is decomposess ARN
into components accordingly to ARN Format
// parseArn is decomposess ARN // into components accordingly to ARN Format
func parseArn(arn string) *Arn {
	sections := strings.Split(arn, ":")
	result := &Arn{
		ARN:          sections[0],
		Partition:    sections[1],
		Service:      sections[2],
		Region:       sections[3],
		AccountID:    sections[4],
		ResourcePath: "",
	}
	if n := strings.Count(sections[5], ":"); n > 0 {
		parts := strings.Split(sections[5], ":")
		result.ResourceType = parts[0]
		result.ResourceID = parts[1]
	} else {
		slashes := strings.Count(sections[5], "/")
		if slashes == 0 {
			result.ResourceID = sections[5]
		} else {
			parts := strings.Split(sections[5], "/")
			result.ResourceType = parts[0]
			result.ResourceID = parts[1]
			result.ResourcePath = strings.Join(parts[2:], "/")
		}
	}
	return result
}
func parseArn ( arn string ) * Arn { sections := strings . Split ( arn , " " ) result := & Arn { ARN : sections [ 0 ] , Partition : sections [ 1 ] , Service : sections [ 2 ] , Region : sections [ 3 ] , AccountID : sections [ 4 ] , ResourcePath : " " , } if n := strings . Count ( sections [ 5 ] , " " ) ; n > 0 { parts := strings . Split ( sections [ 5 ] , " " ) result . ResourceType = parts [ 0 ] result . ResourceID = parts [ 1 ] } else { slashes := strings . Count ( sections [ 5 ] , " " ) if slashes == 0 { result . ResourceID = sections [ 5 ] } else { parts := strings . Split ( sections [ 5 ] , " " ) result . ResourceType = parts [ 0 ] result . ResourceID = parts [ 1 ] result . ResourcePath = strings . Join ( parts [ 2 : ] , " " ) } } return result }
parseArn is decomposess ARN
into components accordingly to ARN Format
parseArn is decomposess ARN into components accordingly to ARN Format