Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rds: SDK 报错, 服务端返回值的层次结构与SDK的struct不一致 #539

Open
wanglong001 opened this issue Nov 26, 2021 · 1 comment

Comments

@wanglong001
Copy link

调用了rds这个接口

// DescribeAvailableZones invokes the rds.DescribeAvailableZones API synchronously
func (client *Client) DescribeAvailableZones(request *DescribeAvailableZonesRequest) (response *DescribeAvailableZonesResponse, err error) {
	response = CreateDescribeAvailableZonesResponse()
	err = client.DoAction(request, response)
	return
}

返回报错:

Failed to unmarshal response, but you can get the data via response.GetHttpStatusCode() and response.GetHttpContentString()

有数据返回,但是解析数据时报错

image

type DescribeAvailableZonesResponse struct {
	*responses.BaseResponse
	RequestId      string          `json:"RequestId" xml:"RequestId"`
	AvailableZones []AvailableZone `json:"AvailableZones" xml:"AvailableZones"`
}

type AvailableZone struct {
	RegionId         string                                      `json:"RegionId" xml:"RegionId"`
	ZoneId           string                                      `json:"ZoneId" xml:"ZoneId"`
	Status           string                                      `json:"Status" xml:"Status"`
	NetworkTypes     string                                      `json:"NetworkTypes" xml:"NetworkTypes"`
	SupportedEngines SupportedEnginesInDescribeAvailableResource `json:"SupportedEngines" xml:"SupportedEngines"`
}

type SupportedEnginesInDescribeAvailableResource struct {
	SupportedEngine []SupportedEngineInDescribeAvailableResource `json:"SupportedEngine" xml:"SupportedEngine"`
}

type SupportedEngineInDescribeAvailableResource struct {
	Engine                  string                                             `json:"Engine" xml:"Engine"`
	SupportedEngineVersions SupportedEngineVersionsInDescribeAvailableResource `json:"SupportedEngineVersions" xml:"SupportedEngineVersions"`
}

理论上json应该得这样

SupportedEngines : {SupportedEngine:[{"SupportedEngineVersions": xxx}]}
@ouyangzhongmin
Copy link

我同样的问题,在k8s内报错,直接build的没问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants