1// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//    http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package v20200506
16
17import (
18    "encoding/json"
19    tcerr "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors"
20    tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
21)
22
23type DescribeTransactionsRequest struct {
24	*tchttp.BaseRequest
25
26	// 事务分组ID
27	GroupId *string `json:"GroupId,omitempty" name:"GroupId"`
28
29	// 事务开始时间查询起始时间戳,UTC,精确到毫秒
30	TransactionBeginFrom *int64 `json:"TransactionBeginFrom,omitempty" name:"TransactionBeginFrom"`
31
32	// 事务开始时间查询截止时间戳,UTC,精确到毫秒
33	TransactionBeginTo *int64 `json:"TransactionBeginTo,omitempty" name:"TransactionBeginTo"`
34
35	// 仅查询异常状态的事务,true:仅查询异常,false或不传入:查询所有
36	SearchError *bool `json:"SearchError,omitempty" name:"SearchError"`
37
38	// 主事务ID,不传入时查询全量,高优先级
39	TransactionId *int64 `json:"TransactionId,omitempty" name:"TransactionId"`
40
41	// 主事务ID列表,不传入时查询全量,低优先级
42	TransactionIdList []*int64 `json:"TransactionIdList,omitempty" name:"TransactionIdList"`
43
44	// 每页数量
45	Limit *int64 `json:"Limit,omitempty" name:"Limit"`
46
47	// 起始偏移量
48	Offset *int64 `json:"Offset,omitempty" name:"Offset"`
49}
50
51func (r *DescribeTransactionsRequest) ToJsonString() string {
52    b, _ := json.Marshal(r)
53    return string(b)
54}
55
56// FromJsonString It is highly **NOT** recommended to use this function
57// because it has no param check, nor strict type check
58func (r *DescribeTransactionsRequest) FromJsonString(s string) error {
59	f := make(map[string]interface{})
60	if err := json.Unmarshal([]byte(s), &f); err != nil {
61		return err
62	}
63	delete(f, "GroupId")
64	delete(f, "TransactionBeginFrom")
65	delete(f, "TransactionBeginTo")
66	delete(f, "SearchError")
67	delete(f, "TransactionId")
68	delete(f, "TransactionIdList")
69	delete(f, "Limit")
70	delete(f, "Offset")
71	if len(f) > 0 {
72		return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTransactionsRequest has unknown keys!", "")
73	}
74	return json.Unmarshal([]byte(s), &r)
75}
76
77type DescribeTransactionsResponse struct {
78	*tchttp.BaseResponse
79	Response *struct {
80
81		// 主事务分页列表
82		Result *PagedTransaction `json:"Result,omitempty" name:"Result"`
83
84		// 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
85		RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
86	} `json:"Response"`
87}
88
89func (r *DescribeTransactionsResponse) ToJsonString() string {
90    b, _ := json.Marshal(r)
91    return string(b)
92}
93
94// FromJsonString It is highly **NOT** recommended to use this function
95// because it has no param check, nor strict type check
96func (r *DescribeTransactionsResponse) FromJsonString(s string) error {
97	return json.Unmarshal([]byte(s), &r)
98}
99
100type PagedTransaction struct {
101
102	// 总条数,特定在该接口中总是会返回null
103	// 注意:此字段可能返回 null,表示取不到有效值。
104	TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
105
106	// 主事务分组列表
107	Content []*Transaction `json:"Content,omitempty" name:"Content"`
108}
109
110type Transaction struct {
111
112	// 主事务ID
113	// 注意:此字段可能返回 null,表示取不到有效值。
114	TransactionId *int64 `json:"TransactionId,omitempty" name:"TransactionId"`
115
116	// 主事务开始时间戳,UTC,精确到毫秒
117	// 注意:此字段可能返回 null,表示取不到有效值。
118	TransactionBegin *int64 `json:"TransactionBegin,omitempty" name:"TransactionBegin"`
119
120	// 主事务结束时间戳,UTC,精确到毫秒
121	// 注意:此字段可能返回 null,表示取不到有效值。
122	TransactionEnd *int64 `json:"TransactionEnd,omitempty" name:"TransactionEnd"`
123
124	// 主事务提交时间戳,UTC,精确到毫秒
125	// 注意:此字段可能返回 null,表示取不到有效值。
126	TransactionCommit *int64 `json:"TransactionCommit,omitempty" name:"TransactionCommit"`
127
128	// 主事务回滚时间戳,UTC,精确到毫秒
129	// 注意:此字段可能返回 null,表示取不到有效值。
130	TransactionRollback *int64 `json:"TransactionRollback,omitempty" name:"TransactionRollback"`
131
132	// 主事务异常停止时间戳,UTC,精确到毫秒
133	// 注意:此字段可能返回 null,表示取不到有效值。
134	TransactionError *int64 `json:"TransactionError,omitempty" name:"TransactionError"`
135
136	// 主事务超时时长,单位毫秒
137	// 注意:此字段可能返回 null,表示取不到有效值。
138	Timeout *int64 `json:"Timeout,omitempty" name:"Timeout"`
139
140	// 主事务状态:0:Trying, 1:Confirming, 2: Confirmed, 3:Canceling, 4: Canceled
141	// 注意:此字段可能返回 null,表示取不到有效值。
142	Status *int64 `json:"Status,omitempty" name:"Status"`
143
144	// 主事务结束标识:0:运行中, 1: 已结束
145	// 注意:此字段可能返回 null,表示取不到有效值。
146	EndFlag *int64 `json:"EndFlag,omitempty" name:"EndFlag"`
147
148	// 主事务超时标识:0:运行中, 1: 已超时
149	// 注意:此字段可能返回 null,表示取不到有效值。
150	TimeoutFlag *int64 `json:"TimeoutFlag,omitempty" name:"TimeoutFlag"`
151
152	// 异常信息
153	// 注意:此字段可能返回 null,表示取不到有效值。
154	Comment *string `json:"Comment,omitempty" name:"Comment"`
155
156	// 事务分组ID
157	// 注意:此字段可能返回 null,表示取不到有效值。
158	GroupId *string `json:"GroupId,omitempty" name:"GroupId"`
159
160	// 主事务来源服务标识
161	// 注意:此字段可能返回 null,表示取不到有效值。
162	Server *string `json:"Server,omitempty" name:"Server"`
163
164	// 分支事务数量
165	// 注意:此字段可能返回 null,表示取不到有效值。
166	BranchQuantity *int64 `json:"BranchQuantity,omitempty" name:"BranchQuantity"`
167
168	// 重试标识:true:可以重试;false:不可重试
169	// 注意:此字段可能返回 null,表示取不到有效值。
170	RetryFlag *bool `json:"RetryFlag,omitempty" name:"RetryFlag"`
171}
172