Skip to content

Commit

Permalink
feat:listInstancesOfProject
Browse files Browse the repository at this point in the history
  • Loading branch information
xfslove committed Jun 4, 2023
1 parent 609947a commit 9799deb
Show file tree
Hide file tree
Showing 8 changed files with 240 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
## Installation
If you use `go mod` to manage your dependence, you can use the following command:
```
go get github.com/aliyun/alibabacloud-yjopenapi-go-client 1.0.20230410
go get github.com/aliyun/alibabacloud-yjopenapi-go-client 1.0.20230602
```

## Usage
Expand Down Expand Up @@ -57,6 +57,7 @@ _ := result
| *ConsoleAdminApi* | **ListDeployableInstances** | *ListDeployableInstancesForms* | *ConsoleAdminListDeployableInstancesResult* | 指定项目和游戏版本,获取可以部署的实例 |
| *ConsoleAdminApi* | **ListGameVersions** | *ListGameVersionsForms* | *ConsoleAdminListGameVersionsResult* | 分页获取游戏版本列表 |
| *ConsoleAdminApi* | **ListGames** | *ListGamesForms* | *ConsoleAdminListGamesResult* | 分页获取游戏列表 |
| *ConsoleAdminApi* | **ListInstancesOfProject** | *ListInstancesOfProjectForms* | *ConsoleAdminListInstancesOfProjectResult* | 分页获取项目中的实例 |
| *ConsoleAdminApi* | **ListProjects** | *ListProjectsForms* | *ConsoleAdminListProjectsResult* | 分页获取项目列表 |
| *ConsoleAdminApi* | **RemoveGameFromProject** | *RemoveGameFromProjectForms* | *ConsoleAdminRemoveGameFromProjectResult* | 将游戏移出项目 |
| *ConsoleAdminApi* | **SubmitDeployment** | *SubmitDeploymentForms* | *ConsoleAdminSubmitDeploymentResult* | 提交游戏版本的部署请求 |
Expand Down Expand Up @@ -88,6 +89,7 @@ _ := result
| *MultiplayApi* | **Leave** | *LeaveForms* | *MultiplayLeaveResult* | 离开联机 |
| *MultiplayApi* | **Modify** | *ModifyForms* | *MultiplayModifyResult* | 修改联机 |
| *MultiplayApi* | **Query** | *QueryForms* | *MultiplayQueryResult* | 离开联机 |
| *TokenApi* | **GetPair** | | *GetPairResult* | 获取临时安全令牌(二元组) |
| *TokenApi* | **GetTriple** | | *GetTripleResult* | 获取临时安全令牌 |
| *UsercontrollerApi* | **DeleteGameArchive** | *DeleteGameArchiveForms* | *UsercontollerDeleteGameArchiveResult* | 根据存档id删除存档纪录 |
| *UsercontrollerApi* | **GetGameTrialSurplusDuration** | *GetGameTrialSurplusDurationForms* | *UsercontollerGetGameTrialSurplusDurationResult* | 查询剩余试玩游戏时长 |
Expand Down
80 changes: 80 additions & 0 deletions client/api/console_admin_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,86 @@ func (s *ConsoleAdminApiService) ListGames(
return varReturnValue, varHttpResponse, nil
}

// ListInstancesOfProject
/*
* 分页获取项目中的实例
* @param varForms model.ConsoleAdminListInstancesOfProjectForms
*/
func (s *ConsoleAdminApiService) ListInstancesOfProject(
varForms *model.ConsoleAdminListInstancesOfProjectForms,
) (model.ConsoleAdminListInstancesOfProjectResult, *http.Response, error) {
var (
varHttpMethod = strings.ToUpper("Post")
varReturnValue model.ConsoleAdminListInstancesOfProjectResult
)

// create path and map variables
varPath := s.client.cfg.Scheme + "://" + s.client.cfg.Host + "/consoleAdmin/listInstancesOfProject"

varHeaderParams := make(map[string]string)
varQueryParams := url.Values{}
varFormParams := url.Values{}

// to determine the Content-Type header
varHttpContentTypes := []string{"application/x-www-form-urlencoded"}

// set Content-Type header
varHttpContentType := selectHeaderContentType(varHttpContentTypes)
if varHttpContentType != "" {
varHeaderParams["Content-Type"] = varHttpContentType
}

// to determine the Accept header
varHttpHeaderAccepts := []string{"application/json"}

// set Accept header
varHttpHeaderAccept := selectHeaderAccept(varHttpHeaderAccepts)
if varHttpHeaderAccept != "" {
varHeaderParams["Accept"] = varHttpHeaderAccept
}
if varForms != nil && varForms.NextToken != nil {
varFormParams.Add("nextToken", parameterToString(*varForms.NextToken, ""))
}
if varForms != nil && varForms.MaxResult != nil {
varFormParams.Add("maxResult", parameterToString(*varForms.MaxResult, ""))
}
varFormParams.Add("projectId", parameterToString(varForms.ProjectId, ""))

r, err := s.client.prepareRequest(varPath, varHttpMethod, varHeaderParams, varQueryParams, varFormParams)
if err != nil {
return varReturnValue, nil, err
}

varHttpResponse, err := s.client.callAPI(r)
if err != nil || varHttpResponse == nil {
return varReturnValue, varHttpResponse, err
}

defer varHttpResponse.Body.Close()
varBody, err := ioutil.ReadAll(varHttpResponse.Body)
if err != nil {
return varReturnValue, varHttpResponse, err
}

if varHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = s.client.decode(&varReturnValue, varBody, varHttpResponse.Header.Get("Content-Type"))
if err == nil {
return varReturnValue, varHttpResponse, err
}
}

if varHttpResponse.StatusCode >= 300 {
newErr := GenericError{
body: varBody,
error: varHttpResponse.Status,
}
return varReturnValue, varHttpResponse, newErr
}

return varReturnValue, varHttpResponse, nil
}

// ListProjects
/*
* 分页获取项目列表
Expand Down
72 changes: 72 additions & 0 deletions client/api/token_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,78 @@ import (
type TokenApiService service


// GetPair
/*
* 获取临时安全令牌(二元组)
*/
func (s *TokenApiService) GetPair(

) (model.GetPairResult, *http.Response, error) {
var (
varHttpMethod = strings.ToUpper("Post")
varReturnValue model.GetPairResult
)

// create path and map variables
varPath := s.client.cfg.Scheme + "://" + s.client.cfg.Host + "/sts?type=pair"

varHeaderParams := make(map[string]string)
varQueryParams := url.Values{}
varFormParams := url.Values{}

// to determine the Content-Type header
varHttpContentTypes := []string{}

// set Content-Type header
varHttpContentType := selectHeaderContentType(varHttpContentTypes)
if varHttpContentType != "" {
varHeaderParams["Content-Type"] = varHttpContentType
}

// to determine the Accept header
varHttpHeaderAccepts := []string{"application/json"}

// set Accept header
varHttpHeaderAccept := selectHeaderAccept(varHttpHeaderAccepts)
if varHttpHeaderAccept != "" {
varHeaderParams["Accept"] = varHttpHeaderAccept
}

r, err := s.client.prepareRequest(varPath, varHttpMethod, varHeaderParams, varQueryParams, varFormParams)
if err != nil {
return varReturnValue, nil, err
}

varHttpResponse, err := s.client.callAPI(r)
if err != nil || varHttpResponse == nil {
return varReturnValue, varHttpResponse, err
}

defer varHttpResponse.Body.Close()
varBody, err := ioutil.ReadAll(varHttpResponse.Body)
if err != nil {
return varReturnValue, varHttpResponse, err
}

if varHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = s.client.decode(&varReturnValue, varBody, varHttpResponse.Header.Get("Content-Type"))
if err == nil {
return varReturnValue, varHttpResponse, err
}
}

if varHttpResponse.StatusCode >= 300 {
newErr := GenericError{
body: varBody,
error: varHttpResponse.Status,
}
return varReturnValue, varHttpResponse, newErr
}

return varReturnValue, varHttpResponse, nil
}

// GetTriple
/*
* 获取临时安全令牌
Expand Down
13 changes: 13 additions & 0 deletions client/model/consoleadminlistinstancesofprojectforms.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Package client
/*
* YuanJing OpenAPI SDK for Go
*
*
*/
package model

type ConsoleAdminListInstancesOfProjectForms struct {
NextToken *string `json:"nextToken,omitempty"`
MaxResult *int64 `json:"maxResult,omitempty"`
ProjectId string `json:"projectId"`
}
14 changes: 14 additions & 0 deletions client/model/consoleadminlistinstancesofprojectresult.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Package client
/*
* YuanJing OpenAPI SDK for Go
*
*
*/
package model

type ConsoleAdminListInstancesOfProjectResult struct {
Success string `json:"success,omitempty"`
Model ConsoleAdminListInstancesOfProjectResultModel `json:"model,omitempty"`
MsgInfo string `json:"msgInfo,omitempty"`
MsgCode string `json:"msgCode,omitempty"`
}
14 changes: 14 additions & 0 deletions client/model/consoleadminlistinstancesofprojectresultmodel.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Package client
/*
* YuanJing OpenAPI SDK for Go
*
*
*/
package model

type ConsoleAdminListInstancesOfProjectResultModel struct {
MaxResult int32 `json:"maxResult,omitempty"`
NextToken string `json:"nextToken,omitempty"`
DataList []ConsoleAdminListInstancesOfProjectResultModelDataList `json:"dataList,omitempty"`
Count int32 `json:"count,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Package client
/*
* YuanJing OpenAPI SDK for Go
*
*
*/
package model

type ConsoleAdminListInstancesOfProjectResultModelDataList struct {
CommoditySpecificationCnName string `json:"commoditySpecificationCnName,omitempty"`
BandwidthChargeType string `json:"bandwidthChargeType,omitempty"`
EffectiveTime int64 `json:"effectiveTime,omitempty"`
PlatformType string `json:"platformType,omitempty"`
PaymentType string `json:"paymentType,omitempty"`
Token string `json:"token,omitempty"`
ExpireTime int64 `json:"expireTime,omitempty"`
CommodityInstanceName string `json:"commodityInstanceName,omitempty"`
CommodityInstanceId string `json:"commodityInstanceId,omitempty"`
Region string `json:"region,omitempty"`
ProjectId string `json:"projectId,omitempty"`
ContainerCount string `json:"containerCount,omitempty"`
Status string `json:"status,omitempty"`
TradeChannel string `json:"tradeChannel,omitempty"`
}
20 changes: 20 additions & 0 deletions client/model/getpairresult.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Package client
/*
* YuanJing OpenAPI SDK for Go
*
*
*/
package model

type GetPairResult struct {
// 临时token
Token string `json:"token,omitempty"`
// 临时secretKey
AccessSecret string `json:"accessSecret,omitempty"`
// token失效时间戳,单位:秒
Expired string `json:"expired,omitempty"`
// 返回码
Code string `json:"code,omitempty"`
// 返回信息
Message string `json:"message,omitempty"`
}

0 comments on commit 9799deb

Please sign in to comment.