Skip to content

Commit

Permalink
reviewed client exposing policy (#59)
Browse files Browse the repository at this point in the history
ENHANCEMENTS:

- Add the public method to customize request/response handler (#59)
- Add the reference of last retried request information to response (#59)

**BROKEN CHANGES**:

- Fix typo `reponse` to `response` for response handler (#59)
  • Loading branch information
yufeiminds authored May 5, 2019
1 parent 5cd9663 commit fb83d4c
Show file tree
Hide file tree
Showing 327 changed files with 672 additions and 908 deletions.
4 changes: 2 additions & 2 deletions internal/services/ubill/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (

// UBillClient is the client of UBill
type UBillClient struct {
client *ucloud.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,
client,
}
}
4 changes: 2 additions & 2 deletions internal/services/ubill/create_renew.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (c *UBillClient) NewCreateRenewRequest() *CreateRenewRequest {
req := &CreateRenewRequest{}

// setup request with client config
c.client.SetupRequest(req)
c.Client.SetupRequest(req)

// setup retryable with default retry policy (retry for non-create action and common error)
req.SetRetryable(true)
Expand All @@ -50,7 +50,7 @@ func (c *UBillClient) CreateRenew(req *CreateRenewRequest) (*CreateRenewResponse
var err error
var res CreateRenewResponse

err = c.client.InvokeAction("CreateRenew", req, &res)
err = c.Client.InvokeAction("CreateRenew", req, &res)
if err != nil {
return &res, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/ubill/describe_order_detail_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (c *UBillClient) NewDescribeOrderDetailInfoRequest() *DescribeOrderDetailIn
req := &DescribeOrderDetailInfoRequest{}

// setup request with client config
c.client.SetupRequest(req)
c.Client.SetupRequest(req)

// setup retryable with default retry policy (retry for non-create action and common error)
req.SetRetryable(true)
Expand All @@ -83,7 +83,7 @@ func (c *UBillClient) DescribeOrderDetailInfo(req *DescribeOrderDetailInfoReques
var err error
var res DescribeOrderDetailInfoResponse

err = c.client.InvokeAction("DescribeOrderDetailInfo", req, &res)
err = c.Client.InvokeAction("DescribeOrderDetailInfo", req, &res)
if err != nil {
return &res, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/ubill/get_resource_renew_price.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (c *UBillClient) NewGetResourceRenewPriceRequest() *GetResourceRenewPriceRe
req := &GetResourceRenewPriceRequest{}

// setup request with client config
c.client.SetupRequest(req)
c.Client.SetupRequest(req)

// setup retryable with default retry policy (retry for non-create action and common error)
req.SetRetryable(true)
Expand All @@ -47,7 +47,7 @@ func (c *UBillClient) GetResourceRenewPrice(req *GetResourceRenewPriceRequest) (
var err error
var res GetResourceRenewPriceResponse

err = c.client.InvokeAction("GetResourceRenewPrice", req, &res)
err = c.Client.InvokeAction("GetResourceRenewPrice", req, &res)
if err != nil {
return &res, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/udataark/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (

// UDataArkClient is the client of UDataArk
type UDataArkClient struct {
client *ucloud.Client
*ucloud.Client
}

// NewClient will return a instance of UDataArkClient
func NewClient(config *ucloud.Config, credential *auth.Credential) *UDataArkClient {
client := ucloud.NewClient(config, credential)
return &UDataArkClient{
client: client,
client,
}
}
4 changes: 2 additions & 2 deletions internal/services/udataark/describe_uhost_tm_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type DescribeUhostTmMetaResponse struct {
// NewDescribeUhostTmMetaRequest will create request of DescribeUhostTmMeta action.
func (c *UDataArkClient) NewDescribeUhostTmMetaRequest() *DescribeUhostTmMetaRequest {
req := &DescribeUhostTmMetaRequest{}
c.client.SetupRequest(req)
c.Client.SetupRequest(req)
return req
}

Expand All @@ -48,7 +48,7 @@ func (c *UDataArkClient) DescribeUhostTmMeta(req *DescribeUhostTmMetaRequest) (*
var err error
var res DescribeUhostTmMetaResponse

err = c.client.InvokeAction("DescribeUhostTmMeta", req, &res)
err = c.Client.InvokeAction("DescribeUhostTmMeta", req, &res)
if err != nil {
return &res, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/udataark/describe_vdisk_tm_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (c *UDataArkClient) NewDescribeVDiskTmListRequest() *DescribeVDiskTmListReq
req := &DescribeVDiskTmListRequest{}

// setup request with client config
c.client.SetupRequest(req)
c.Client.SetupRequest(req)

// setup retryable with default retry policy (retry for non-create action and common error)
req.SetRetryable(true)
Expand All @@ -59,7 +59,7 @@ func (c *UDataArkClient) DescribeVDiskTmList(req *DescribeVDiskTmListRequest) (*
var err error
var res DescribeVDiskTmListResponse

err = c.client.InvokeAction("DescribeVDiskTmList", req, &res)
err = c.Client.InvokeAction("DescribeVDiskTmList", req, &res)
if err != nil {
return &res, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/udb/change_udbparam_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (c *UDBClient) NewChangeUDBParamGroupRequest() *ChangeUDBParamGroupRequest
req := &ChangeUDBParamGroupRequest{}

// setup request with client config
c.client.SetupRequest(req)
c.Client.SetupRequest(req)

// setup retryable with default retry policy (retry for non-create action and common error)
req.SetRetryable(true)
Expand All @@ -44,7 +44,7 @@ func (c *UDBClient) ChangeUDBParamGroup(req *ChangeUDBParamGroupRequest) (*Chang
var err error
var res ChangeUDBParamGroupResponse

err = c.client.InvokeAction("ChangeUDBParamGroup", req, &res)
err = c.Client.InvokeAction("ChangeUDBParamGroup", req, &res)
if err != nil {
return &res, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/udb/check_udbinstance_allowance.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (c *UDBClient) NewCheckUDBInstanceAllowanceRequest() *CheckUDBInstanceAllow
req := &CheckUDBInstanceAllowanceRequest{}

// setup request with client config
c.client.SetupRequest(req)
c.Client.SetupRequest(req)

// setup retryable with default retry policy (retry for non-create action and common error)
req.SetRetryable(true)
Expand All @@ -74,7 +74,7 @@ func (c *UDBClient) CheckUDBInstanceAllowance(req *CheckUDBInstanceAllowanceRequ
var err error
var res CheckUDBInstanceAllowanceResponse

err = c.client.InvokeAction("CheckUDBInstanceAllowance", req, &res)
err = c.Client.InvokeAction("CheckUDBInstanceAllowance", req, &res)
if err != nil {
return &res, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/udb/check_udbinstance_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (c *UDBClient) NewCheckUDBInstanceConnectionRequest() *CheckUDBInstanceConn
req := &CheckUDBInstanceConnectionRequest{}

// setup request with client config
c.client.SetupRequest(req)
c.Client.SetupRequest(req)

// setup retryable with default retry policy (retry for non-create action and common error)
req.SetRetryable(true)
Expand All @@ -41,7 +41,7 @@ func (c *UDBClient) CheckUDBInstanceConnection(req *CheckUDBInstanceConnectionRe
var err error
var res CheckUDBInstanceConnectionResponse

err = c.client.InvokeAction("CheckUDBInstanceConnection", req, &res)
err = c.Client.InvokeAction("CheckUDBInstanceConnection", req, &res)
if err != nil {
return &res, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/udb/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (

// UDBClient is the client of UDB
type UDBClient struct {
client *ucloud.Client
*ucloud.Client
}

// NewClient will return a instance of UDBClient
func NewClient(config *ucloud.Config, credential *auth.Credential) *UDBClient {
client := ucloud.NewClient(config, credential)
return &UDBClient{
client: client,
client,
}
}
4 changes: 2 additions & 2 deletions internal/services/udb/describe_promote_to_haprice.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (c *UDBClient) NewDescribePromoteToHAPriceRequest() *DescribePromoteToHAPri
req := &DescribePromoteToHAPriceRequest{}

// setup request with client config
c.client.SetupRequest(req)
c.Client.SetupRequest(req)

// setup retryable with default retry policy (retry for non-create action and common error)
req.SetRetryable(true)
Expand All @@ -47,7 +47,7 @@ func (c *UDBClient) DescribePromoteToHAPrice(req *DescribePromoteToHAPriceReques
var err error
var res DescribePromoteToHAPriceResponse

err = c.client.InvokeAction("DescribePromoteToHAPrice", req, &res)
err = c.Client.InvokeAction("DescribePromoteToHAPrice", req, &res)
if err != nil {
return &res, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (c *UDBClient) NewDescribeUDBInstancePhpMyAdminURLRequest() *DescribeUDBIns
req := &DescribeUDBInstancePhpMyAdminURLRequest{}

// setup request with client config
c.client.SetupRequest(req)
c.Client.SetupRequest(req)

// setup retryable with default retry policy (retry for non-create action and common error)
req.SetRetryable(true)
Expand All @@ -44,7 +44,7 @@ func (c *UDBClient) DescribeUDBInstancePhpMyAdminURL(req *DescribeUDBInstancePhp
var err error
var res DescribeUDBInstancePhpMyAdminURLResponse

err = c.client.InvokeAction("DescribeUDBInstancePhpMyAdminURL", req, &res)
err = c.Client.InvokeAction("DescribeUDBInstancePhpMyAdminURL", req, &res)
if err != nil {
return &res, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (c *UDBClient) NewDescribeUDBSlaveOrSecondaryInstanceRequest() *DescribeUDB
req := &DescribeUDBSlaveOrSecondaryInstanceRequest{}

// setup request with client config
c.client.SetupRequest(req)
c.Client.SetupRequest(req)

// setup retryable with default retry policy (retry for non-create action and common error)
req.SetRetryable(true)
Expand All @@ -47,7 +47,7 @@ func (c *UDBClient) DescribeUDBSlaveOrSecondaryInstance(req *DescribeUDBSlaveOrS
var err error
var res DescribeUDBSlaveOrSecondaryInstanceResponse

err = c.client.InvokeAction("DescribeUDBSlaveOrSecondaryInstance", req, &res)
err = c.Client.InvokeAction("DescribeUDBSlaveOrSecondaryInstance", req, &res)
if err != nil {
return &res, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/udisk/check_udisk_allowance.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type CheckUDiskAllowanceResponse struct {
// NewCheckUDiskAllowanceRequest will create request of CheckUDiskAllowance action.
func (c *UDiskClient) NewCheckUDiskAllowanceRequest() *CheckUDiskAllowanceRequest {
req := &CheckUDiskAllowanceRequest{}
c.client.SetupRequest(req)
c.Client.SetupRequest(req)
return req
}

Expand All @@ -42,7 +42,7 @@ func (c *UDiskClient) CheckUDiskAllowance(req *CheckUDiskAllowanceRequest) (*Che
var err error
var res CheckUDiskAllowanceResponse

err = c.client.InvokeAction("CheckUDiskAllowance", req, &res)
err = c.Client.InvokeAction("CheckUDiskAllowance", req, &res)
if err != nil {
return &res, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/udisk/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (

// UDiskClient is the client of UDisk
type UDiskClient struct {
client *ucloud.Client
*ucloud.Client
}

// NewClient will return a instance of UDiskClient
func NewClient(config *ucloud.Config, credential *auth.Credential) *UDiskClient {
client := ucloud.NewClient(config, credential)
return &UDiskClient{
client: client,
client,
}
}
4 changes: 2 additions & 2 deletions internal/services/udisk/clone_udisk_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type CloneUDiskSnapshotResponse struct {
// NewCloneUDiskSnapshotRequest will create request of CloneUDiskSnapshot action.
func (c *UDiskClient) NewCloneUDiskSnapshotRequest() *CloneUDiskSnapshotRequest {
req := &CloneUDiskSnapshotRequest{}
c.client.SetupRequest(req)
c.Client.SetupRequest(req)
return req
}

Expand All @@ -60,7 +60,7 @@ func (c *UDiskClient) CloneUDiskSnapshot(req *CloneUDiskSnapshotRequest) (*Clone
var err error
var res CloneUDiskSnapshotResponse

err = c.client.InvokeAction("CloneUDiskSnapshot", req, &res)
err = c.Client.InvokeAction("CloneUDiskSnapshot", req, &res)
if err != nil {
return &res, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/udisk/create_udisk_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type CreateUDiskSnapshotResponse struct {
// NewCreateUDiskSnapshotRequest will create request of CreateUDiskSnapshot action.
func (c *UDiskClient) NewCreateUDiskSnapshotRequest() *CreateUDiskSnapshotRequest {
req := &CreateUDiskSnapshotRequest{}
c.client.SetupRequest(req)
c.Client.SetupRequest(req)
return req
}

Expand All @@ -51,7 +51,7 @@ func (c *UDiskClient) CreateUDiskSnapshot(req *CreateUDiskSnapshotRequest) (*Cre
var err error
var res CreateUDiskSnapshotResponse

err = c.client.InvokeAction("CreateUDiskSnapshot", req, &res)
err = c.Client.InvokeAction("CreateUDiskSnapshot", req, &res)
if err != nil {
return &res, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/udpn/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (

// UDPNClient is the client of UDPN
type UDPNClient struct {
client *ucloud.Client
*ucloud.Client
}

// NewClient will return a instance of UDPNClient
func NewClient(config *ucloud.Config, credential *auth.Credential) *UDPNClient {
client := ucloud.NewClient(config, credential)
return &UDPNClient{
client: client,
client,
}
}
4 changes: 2 additions & 2 deletions internal/services/ufs/clear_ufsvolume_white_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (c *UFSClient) NewClearUFSVolumeWhiteListRequest() *ClearUFSVolumeWhiteList
req := &ClearUFSVolumeWhiteListRequest{}

// setup request with client config
c.client.SetupRequest(req)
c.Client.SetupRequest(req)

// setup retryable with default retry policy (retry for non-create action and common error)
req.SetRetryable(true)
Expand All @@ -44,7 +44,7 @@ func (c *UFSClient) ClearUFSVolumeWhiteList(req *ClearUFSVolumeWhiteListRequest)
var err error
var res ClearUFSVolumeWhiteListResponse

err = c.client.InvokeAction("ClearUFSVolumeWhiteList", req, &res)
err = c.Client.InvokeAction("ClearUFSVolumeWhiteList", req, &res)
if err != nil {
return &res, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/ufs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (

// UFSClient is the client of UFS
type UFSClient struct {
client *ucloud.Client
*ucloud.Client
}

// NewClient will return a instance of UFSClient
func NewClient(config *ucloud.Config, credential *auth.Credential) *UFSClient {
client := ucloud.NewClient(config, credential)
return &UFSClient{
client: client,
client,
}
}
4 changes: 2 additions & 2 deletions internal/services/uhost/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (

// UHostClient is the client of UHost
type UHostClient struct {
client *ucloud.Client
*ucloud.Client
}

// NewClient will return a instance of UHostClient
func NewClient(config *ucloud.Config, credential *auth.Credential) *UHostClient {
client := ucloud.NewClient(config, credential)
return &UHostClient{
client: client,
client,
}
}
4 changes: 2 additions & 2 deletions internal/services/uhost/describe_uhost_lite.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type DescribeUHostLiteResponse struct {
// NewDescribeUHostLiteRequest will create request of DescribeUHostLite action.
func (c *UHostClient) NewDescribeUHostLiteRequest() *DescribeUHostLiteRequest {
req := &DescribeUHostLiteRequest{}
c.client.SetupRequest(req)
c.Client.SetupRequest(req)
return req
}

Expand All @@ -54,7 +54,7 @@ func (c *UHostClient) DescribeUHostLite(req *DescribeUHostLiteRequest) (*Describ
var err error
var res DescribeUHostLiteResponse

err = c.client.InvokeAction("DescribeUHostLite", req, &res)
err = c.Client.InvokeAction("DescribeUHostLite", req, &res)
if err != nil {
return &res, err
}
Expand Down
Loading

0 comments on commit fb83d4c

Please sign in to comment.