Skip to content

Commit

Permalink
Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangpengcheng committed Jan 29, 2024
1 parent 6dabcd9 commit dc9cf43
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions pulsar/resource_pulsar_namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -791,16 +791,9 @@ func unmarshalTopicAutoCreation(v *schema.Set) (*utils.TopicAutoCreationConfig,
topicAutoCreation.Allow = data["enable"].(bool)
topicAutoCreation.Type = utils.TopicType(data["type"].(string))
if topicAutoCreation.Type == utils.Partitioned {
if data["partitions"] == nil {
return nil, fmt.Errorf("ERROR_PARSE_TOPIC_AUTO_CREATION: partitions is required for partitioned topic")
}
partitions := data["partitions"].(int)
topicAutoCreation.Partitions = &partitions
} else if topicAutoCreation.Type == utils.NonPartitioned {
if data["partitions"] != nil {
return nil, fmt.Errorf("ERROR_PARSE_TOPIC_AUTO_CREATION: partitions is not allowed for non-partitioned topic")
}
} else {
} else if topicAutoCreation.Type != utils.NonPartitioned {
return nil, fmt.Errorf("ERROR_PARSE_TOPIC_AUTO_CREATION: unknown topic type %s", topicAutoCreation.Type)
}
}
Expand Down

0 comments on commit dc9cf43

Please sign in to comment.