From 9799debdedd30940894750d857e6ce535e567e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E6=99=A8?= Date: Sun, 4 Jun 2023 12:31:15 +0800 Subject: [PATCH] feat:listInstancesOfProject --- README.md | 4 +- client/api/console_admin_api.go | 80 +++++++++++++++++++ client/api/token_api.go | 72 +++++++++++++++++ ...consoleadminlistinstancesofprojectforms.go | 13 +++ ...onsoleadminlistinstancesofprojectresult.go | 14 ++++ ...eadminlistinstancesofprojectresultmodel.go | 14 ++++ ...stinstancesofprojectresultmodeldatalist.go | 24 ++++++ client/model/getpairresult.go | 20 +++++ 8 files changed, 240 insertions(+), 1 deletion(-) create mode 100644 client/model/consoleadminlistinstancesofprojectforms.go create mode 100644 client/model/consoleadminlistinstancesofprojectresult.go create mode 100644 client/model/consoleadminlistinstancesofprojectresultmodel.go create mode 100644 client/model/consoleadminlistinstancesofprojectresultmodeldatalist.go create mode 100644 client/model/getpairresult.go diff --git a/README.md b/README.md index b3f45b98..f020b818 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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* | 提交游戏版本的部署请求 | @@ -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* | 查询剩余试玩游戏时长 | diff --git a/client/api/console_admin_api.go b/client/api/console_admin_api.go index 16c6907a..9f2357e1 100644 --- a/client/api/console_admin_api.go +++ b/client/api/console_admin_api.go @@ -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 /* * 分页获取项目列表 diff --git a/client/api/token_api.go b/client/api/token_api.go index a37c8d44..30ad2ce4 100644 --- a/client/api/token_api.go +++ b/client/api/token_api.go @@ -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 /* * 获取临时安全令牌 diff --git a/client/model/consoleadminlistinstancesofprojectforms.go b/client/model/consoleadminlistinstancesofprojectforms.go new file mode 100644 index 00000000..ea1c0631 --- /dev/null +++ b/client/model/consoleadminlistinstancesofprojectforms.go @@ -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"` +} diff --git a/client/model/consoleadminlistinstancesofprojectresult.go b/client/model/consoleadminlistinstancesofprojectresult.go new file mode 100644 index 00000000..3f17c99e --- /dev/null +++ b/client/model/consoleadminlistinstancesofprojectresult.go @@ -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"` +} diff --git a/client/model/consoleadminlistinstancesofprojectresultmodel.go b/client/model/consoleadminlistinstancesofprojectresultmodel.go new file mode 100644 index 00000000..ad3d571f --- /dev/null +++ b/client/model/consoleadminlistinstancesofprojectresultmodel.go @@ -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"` +} diff --git a/client/model/consoleadminlistinstancesofprojectresultmodeldatalist.go b/client/model/consoleadminlistinstancesofprojectresultmodeldatalist.go new file mode 100644 index 00000000..ac48dd9d --- /dev/null +++ b/client/model/consoleadminlistinstancesofprojectresultmodeldatalist.go @@ -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"` +} diff --git a/client/model/getpairresult.go b/client/model/getpairresult.go new file mode 100644 index 00000000..09bb26ef --- /dev/null +++ b/client/model/getpairresult.go @@ -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"` +}