func()

in datahub/implement.go [318:346]


func (datahub *DataHub) UpdateTopicWithPara(projectName, topicName string, para *UpdateTopicParameter) (*UpdateTopicResult, error) {
	if !util.CheckProjectName(projectName) {
		return nil, NewInvalidParameterErrorWithMessage(projectNameInvalid)
	}
	if !util.CheckTopicName(topicName) {
		return nil, NewInvalidParameterErrorWithMessage(topicNameInvalid)
	}
	if para == nil {
		return nil, NewInvalidParameterErrorWithMessage(parameterNull)
	}
	if !util.CheckComment(para.Comment) {
		return nil, NewInvalidParameterErrorWithMessage(commentInvalid)
	}

	path := fmt.Sprintf(topicPath, projectName, topicName)
	reqPara := &RequestParameter{
		Header: map[string]string{httpHeaderContentType: httpJsonContent},
	}
	ut := &UpdateTopicRequest{
		Lifecycle: para.LifeCycle,
		Comment:   para.Comment,
	}

	_, commonResp, err := datahub.Client.Put(path, ut, reqPara)
	if err != nil {
		return nil, err
	}
	return NewUpdateTopicResult(commonResp)
}