Remove duplicate []interface{} to []string method (#388)

This commit is contained in:
Vincent Roseberry 2017-09-05 14:37:02 -07:00 committed by GitHub
parent 6499b12395
commit b082eb0b65
2 changed files with 4 additions and 13 deletions

View File

@ -63,7 +63,7 @@ func resourceBigtableTableCreate(d *schema.ResourceData, meta interface{}) error
name := d.Get("name").(string)
if v, ok := d.GetOk("split_keys"); ok {
splitKeys := convertSchemaArrayToStringArray(v.([]interface{}))
splitKeys := convertStringArr(v.([]interface{}))
// This method may return before the table's creation is complete - we may need to wait until
// it exists in the future.
err = c.CreatePresplitTable(ctx, name, splitKeys)

View File

@ -422,9 +422,9 @@ func expandCors(configured []interface{}) []*storage.BucketCors {
for _, raw := range configured {
data := raw.(map[string]interface{})
corsRule := storage.BucketCors{
Origin: convertSchemaArrayToStringArray(data["origin"].([]interface{})),
Method: convertSchemaArrayToStringArray(data["method"].([]interface{})),
ResponseHeader: convertSchemaArrayToStringArray(data["response_header"].([]interface{})),
Origin: convertStringArr(data["origin"].([]interface{})),
Method: convertStringArr(data["method"].([]interface{})),
ResponseHeader: convertStringArr(data["response_header"].([]interface{})),
MaxAgeSeconds: int64(data["max_age_seconds"].(int)),
}
@ -433,15 +433,6 @@ func expandCors(configured []interface{}) []*storage.BucketCors {
return corsRules
}
func convertSchemaArrayToStringArray(input []interface{}) []string {
output := make([]string, 0, len(input))
for _, val := range input {
output = append(output, val.(string))
}
return output
}
func flattenCors(corsRules []*storage.BucketCors) []map[string]interface{} {
corsRulesSchema := make([]map[string]interface{}, 0, len(corsRules))
for _, corsRule := range corsRules {