-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
487 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package ubill | ||
|
||
import ( | ||
"github.com/ucloud/ucloud-sdk-go/ucloud" | ||
"github.com/ucloud/ucloud-sdk-go/ucloud/auth" | ||
) | ||
|
||
// UBillClient is the client of UBill | ||
type UBillClient struct { | ||
client *ucloud.Client | ||
} | ||
|
||
// NewClient will return a instance of UBillClient | ||
func NewClient(config *ucloud.Config, credential *auth.Credential) *UBillClient { | ||
client := ucloud.NewClient(config, credential) | ||
return &UBillClient{ | ||
client: client, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package ubill | ||
|
||
import ( | ||
"github.com/ucloud/ucloud-sdk-go/ucloud/request" | ||
"github.com/ucloud/ucloud-sdk-go/ucloud/response" | ||
) | ||
|
||
type DescribeOrderDetailInfoRequest struct { | ||
request.CommonBase | ||
|
||
//开始时间,UNIX time format | ||
BeginTime *int `required:"true"` | ||
|
||
//结束时间,时间跨度不超过3个月 | ||
EndTime *int `required:"true"` | ||
|
||
Regions []string `required:"true"` | ||
|
||
//产品类型,默认全部的产品类型 | ||
ResourceTypes []string `required:"false"` | ||
|
||
//订单类型,默认全部订单类型 | ||
OrderTypes []string `required:"false"` | ||
|
||
//付费类型,默认全部的计费方式 | ||
ChargeTypes []string | ||
|
||
//订单状态,默认选中全部的可选参数 | ||
OrderStates []string `required:"false"` | ||
|
||
//是否开过发票,默认选中全部的可选参数 | ||
Invoiceds []string `required:"false"` | ||
|
||
//返回数据长度,默认25 | ||
Limit *int `required:"false"` | ||
|
||
//数据偏移量,默认0 | ||
Offset *int `required:"false"` | ||
|
||
//资源ID | ||
ResourceIds []string `required:"false"` | ||
|
||
//交易单号,该字段存在时,可以不传BeginTime和EndTime | ||
TradeNos []string `required:"false"` | ||
|
||
//true表示查询全部,默认全部,其他选项按照项目自查询 | ||
QueryAll *string `required:"false"` | ||
} | ||
|
||
// DescribeOrderDetailInfoResponse is response schema for DescribeOrderDetailInfo action | ||
type DescribeOrderDetailInfoResponse struct { | ||
response.CommonBase | ||
|
||
//json格式的订单信息 | ||
OrderInfos []OrderInfo | ||
} | ||
|
||
// NewDescribeOrderDetailInfoRequest will create request of DescribeOrderDetailInfo action. | ||
func (c *UBillClient) NewDescribeOrderDetailInfoRequest() *DescribeOrderDetailInfoRequest { | ||
req := &DescribeOrderDetailInfoRequest{} | ||
|
||
//设置client请求配置config | ||
c.client.SetupRequest(req) | ||
|
||
//设置默认重试 | ||
req.SetRetryable(true) | ||
return req | ||
} | ||
|
||
// DescribeOrderDetailInfo - 获取订单信息 | ||
func (c *UBillClient) DescribeOrderDetailInfo(req *DescribeOrderDetailInfoRequest) (*DescribeOrderDetailInfoResponse, error) { | ||
var err error | ||
var res DescribeOrderDetailInfoResponse | ||
|
||
err = c.client.InvokeAction("DescribeOrderDetailInfo", req, &res) | ||
if err != nil { | ||
return &res, err | ||
} | ||
|
||
return &res, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package ubill | ||
|
||
type OrderDetail struct { | ||
ProductName string | ||
Value string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package ubill | ||
|
||
type OrderInfo struct { | ||
OrderNo string `json:"OrderNo"` | ||
OrderType string | ||
ChargeType string | ||
ResourceId string | ||
ResourceTag []ResourceTag | ||
OrderState string | ||
CreateTime int | ||
Amount string //订单总金额 | ||
AmountReal string //现金账户金额 | ||
AmountFree string //赠送账户金额(元) | ||
AmountCoupon string //优惠金额 | ||
CouponCode string //如果AmountCoupon不为0,显示代金券号码 | ||
ResourceType string | ||
UpdateTime int | ||
Quantity string //计费周期数 | ||
Count int //资源数量 | ||
Invoiced string //是否开过发票 | ||
StartTime int //开始时间 | ||
EndTime int //结束时间 | ||
OrderDetails []OrderDetail | ||
RegionId string //region | ||
TradeNo string //交易号 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package ubill | ||
|
||
type ResourceTag struct { | ||
KeyId string //标识名,见下表 | ||
Value string //标识信息 | ||
} | ||
|
||
/*KeyId Description | ||
name 名称(eg. “hello_vm”) | ||
hostname 主机名(eg. “uhost-0zjhzf”) | ||
domain 域名(高防, eg. “www.qq.com”) | ||
private_ip 内网IP | ||
public_ip 外网IP | ||
remark 备注 | ||
tag 标签 */ |
Oops, something went wrong.