From 609947a842d94167b05a9720d374152d9a5db157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E6=99=A8?= Date: Mon, 10 Apr 2023 11:19:46 +0800 Subject: [PATCH] feat: consoleAdmin --- README.md | 6 +- client/api/client.go | 241 +++++++------- client/api/console_admin_api.go | 309 ++++++++++++++++++ .../consoleadminactivatedeploymentforms.go | 18 + .../consoleadminactivatedeploymentresult.go | 17 + ...nsoleadminactivatedeploymentresultmodel.go | 12 + ...soleadminlistactivateableinstancesforms.go | 14 + ...oleadminlistactivateableinstancesresult.go | 17 + ...minlistactivateableinstancesresultmodel.go | 14 + ...ctivateableinstancesresultmodeldatalist.go | 18 + ...consoleadminlistactivatedinstancesforms.go | 14 + ...onsoleadminlistactivatedinstancesresult.go | 17 + ...eadminlistactivatedinstancesresultmodel.go | 14 + ...stactivatedinstancesresultmodeldatalist.go | 18 + .../consoleadminlistcontrollersofgameforms.go | 16 + ...consoleadminlistcontrollersofgameresult.go | 17 + ...leadminlistcontrollersofgameresultmodel.go | 18 + ...istcontrollersofgameresultmodeldatalist.go | 24 ++ 18 files changed, 682 insertions(+), 122 deletions(-) create mode 100644 client/model/consoleadminactivatedeploymentforms.go create mode 100644 client/model/consoleadminactivatedeploymentresult.go create mode 100644 client/model/consoleadminactivatedeploymentresultmodel.go create mode 100644 client/model/consoleadminlistactivateableinstancesforms.go create mode 100644 client/model/consoleadminlistactivateableinstancesresult.go create mode 100644 client/model/consoleadminlistactivateableinstancesresultmodel.go create mode 100644 client/model/consoleadminlistactivateableinstancesresultmodeldatalist.go create mode 100644 client/model/consoleadminlistactivatedinstancesforms.go create mode 100644 client/model/consoleadminlistactivatedinstancesresult.go create mode 100644 client/model/consoleadminlistactivatedinstancesresultmodel.go create mode 100644 client/model/consoleadminlistactivatedinstancesresultmodeldatalist.go create mode 100644 client/model/consoleadminlistcontrollersofgameforms.go create mode 100644 client/model/consoleadminlistcontrollersofgameresult.go create mode 100644 client/model/consoleadminlistcontrollersofgameresultmodel.go create mode 100644 client/model/consoleadminlistcontrollersofgameresultmodeldatalist.go diff --git a/README.md b/README.md index a1114347..b3f45b98 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.20230321 +go get github.com/aliyun/alibabacloud-yjopenapi-go-client 1.0.20230410 ``` ## Usage @@ -41,6 +41,7 @@ _ := result | Api | Method | Params | Result | Description | | ------------ | ------------- | ------------- | ------------- | ------------- | + | *ConsoleAdminApi* | **ActivateDeployment** | *ActivateDeploymentForms* | *ConsoleAdminActivateDeploymentResult* | 激活已部署成功的游戏版本的部署 | | *ConsoleAdminApi* | **AdaptGameVersion** | *AdaptGameVersionForms* | *ConsoleAdminAdaptGameVersionResult* | 发起游戏版本适配 | | *ConsoleAdminApi* | **AddGameToProject** | *AddGameToProjectForms* | *ConsoleAdminAddGameToProjectResult* | 将游戏添加到项目 | | *ConsoleAdminApi* | **CreateGame** | *CreateGameForms* | *ConsoleAdminCreateGameResult* | 创建游戏 | @@ -50,6 +51,9 @@ _ := result | *ConsoleAdminApi* | **DeleteProject** | *DeleteProjectForms* | *ConsoleAdminDeleteProjectResult* | 删除指定的项目 | | *ConsoleAdminApi* | **GetGameVersion** | *GetGameVersionForms* | *ConsoleAdminGetGameVersionResult* | 获取单个游戏版本信息 | | *ConsoleAdminApi* | **GetGameVersionProgress** | *GetGameVersionProgressForms* | *ConsoleAdminGetGameVersionProgressResult* | 查询版本处理进度(包含上传、适配、部署) | + | *ConsoleAdminApi* | **ListActivateableInstances** | *ListActivateableInstancesForms* | *ConsoleAdminListActivateableInstancesResult* | 指定项目和游戏版本,获取可激活且可调度的实例及调度配置 | + | *ConsoleAdminApi* | **ListActivatedInstances** | *ListActivatedInstancesForms* | *ConsoleAdminListActivatedInstancesResult* | 指定项目和游戏,获取已激活版本的可调度实例及调度配置 | + | *ConsoleAdminApi* | **ListControllersOfGame** | *ListControllersOfGameForms* | *ConsoleAdminListControllersOfGameResult* | 获取单个游戏关联的控制器列表 | | *ConsoleAdminApi* | **ListDeployableInstances** | *ListDeployableInstancesForms* | *ConsoleAdminListDeployableInstancesResult* | 指定项目和游戏版本,获取可以部署的实例 | | *ConsoleAdminApi* | **ListGameVersions** | *ListGameVersionsForms* | *ConsoleAdminListGameVersionsResult* | 分页获取游戏版本列表 | | *ConsoleAdminApi* | **ListGames** | *ListGamesForms* | *ConsoleAdminListGamesResult* | 分页获取游戏列表 | diff --git a/client/api/client.go b/client/api/client.go index fbed4e7d..5eaad3f0 100644 --- a/client/api/client.go +++ b/client/api/client.go @@ -7,38 +7,37 @@ package api import ( - "bytes" - "crypto/md5" - "crypto/rand" - "encoding/hex" - "encoding/json" - "errors" - "fmt" - "net/http" - "net/url" - "reflect" - "regexp" - "sort" - "strconv" - "strings" - "time" - "unicode/utf8" - + "bytes" + "crypto/md5" + "crypto/rand" + "encoding/hex" + "encoding/json" + "errors" + "fmt" + "net/http" + "net/url" + "reflect" + "regexp" + "sort" + "strconv" + "strings" + "time" + "unicode/utf8" ) const ( - Trace_Id string = "Traceid" - Result_Status string = "Result-Status" + Trace_Id string = "Traceid" + Result_Status string = "Result-Status" ) var ( jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") - DefaultConfiguration = NewConfiguration() + DefaultConfiguration = NewConfiguration() ) -// APIClient manages communication with the API v1.0.20221125 +// APIClient manages communication with the API // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *Configuration @@ -142,34 +141,34 @@ func typeCheckParameter(obj interface{}, expected string, name string) error { // parameterToString convert interface{} parameters to string, using a delimiter if format is provided. func parameterToString(obj interface{}, collectionFormat string) string { -// var delimiter string - -// switch collectionFormat { -// case "pipes": -// delimiter = "|" -// case "ssv": -// delimiter = " " -// case "tsv": -// delimiter = "\t" -// case "csv": -// delimiter = "," -// } + // var delimiter string + + // switch collectionFormat { + // case "pipes": + // delimiter = "|" + // case "ssv": + // delimiter = " " + // case "tsv": + // delimiter = "\t" + // case "csv": + // delimiter = "," + // } if reflect.TypeOf(obj).Kind() == reflect.Slice { -// return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") - if marshal, err := json.Marshal(obj); err != nil { - return "" - } else { - return string(marshal) - } + // return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + if marshal, err := json.Marshal(obj); err != nil { + return "" + } else { + return string(marshal) + } + } + if reflect.TypeOf(obj).Kind() == reflect.Struct { + if marshal, err := json.Marshal(obj); err != nil { + return "" + } else { + return string(marshal) + } } - if reflect.TypeOf(obj).Kind() == reflect.Struct { - if marshal, err := json.Marshal(obj); err != nil { - return "" - } else { - return string(marshal) - } - } return fmt.Sprintf("%v", obj) } @@ -181,7 +180,7 @@ func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { // prepareRequest build the request func (c *APIClient) prepareRequest( path string, - method string, + method string, headerParams map[string]string, queryParams url.Values, formParams url.Values, @@ -241,8 +240,8 @@ func (c *APIClient) prepareRequest( // Add the user agent to the request. localVarRequest.Header.Add("User-Agent", "cgw-client/1.0.0/go") - // prepare sign headers - prepareSignHeader(queryParams, formParams, localVarRequest, c.cfg) + // prepare sign headers + prepareSignHeader(queryParams, formParams, localVarRequest, c.cfg) for header, value := range c.cfg.DefaultHeader { localVarRequest.Header.Add(header, value) @@ -253,11 +252,11 @@ func (c *APIClient) prepareRequest( func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { if strings.Contains(contentType, "application/json") { - if err = json.Unmarshal(b, v); err != nil { - return err - } - return nil - } + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } return errors.New("undefined response type") } @@ -320,79 +319,79 @@ func strlen(s string) int { } func prepareSignHeader(queryParams url.Values, formParams url.Values, localVarRequest *http.Request, cfg *Configuration) { - accessKey := cfg.AccessKey - nonce := randNonce(16) - version := cfg.SignatureVersion - timestamp := time.Now().UTC().Format(time.RFC3339) - method := cfg.SignatureMethod - - values := url.Values{} - values.Add("AccessKey", accessKey) - values.Add("SignatureNonce", nonce) - values.Add("SignatureVersion", version) - values.Add("SignatureMethod", method) - values.Add("Timestamp", timestamp) - if len(queryParams) > 0 { - for s, i := range queryParams { - for _, s2 := range i { - values.Add(s, s2) - } - } - } - if len(formParams) > 0 { - for s, i := range formParams { - for _, s2 := range i { - values.Add(s, s2) - } - } - } - - sign := md5Hex([]byte(getSignRaw(values, localVarRequest.Method, cfg.SecretKey))) - localVarRequest.Header.Add("Signature", sign) - localVarRequest.Header.Add("Accesskey", accessKey) - localVarRequest.Header.Add("Signaturenonce", nonce) - localVarRequest.Header.Add("Signatureversion", version) - localVarRequest.Header.Add("Timestamp", timestamp) - localVarRequest.Header.Add("Signaturemethod", method) + accessKey := cfg.AccessKey + nonce := randNonce(16) + version := cfg.SignatureVersion + timestamp := time.Now().UTC().Format(time.RFC3339) + method := cfg.SignatureMethod + + values := url.Values{} + values.Add("AccessKey", accessKey) + values.Add("SignatureNonce", nonce) + values.Add("SignatureVersion", version) + values.Add("SignatureMethod", method) + values.Add("Timestamp", timestamp) + if len(queryParams) > 0 { + for s, i := range queryParams { + for _, s2 := range i { + values.Add(s, s2) + } + } + } + if len(formParams) > 0 { + for s, i := range formParams { + for _, s2 := range i { + values.Add(s, s2) + } + } + } + + sign := md5Hex([]byte(getSignRaw(values, localVarRequest.Method, cfg.SecretKey))) + localVarRequest.Header.Add("Signature", sign) + localVarRequest.Header.Add("Accesskey", accessKey) + localVarRequest.Header.Add("Signaturenonce", nonce) + localVarRequest.Header.Add("Signatureversion", version) + localVarRequest.Header.Add("Timestamp", timestamp) + localVarRequest.Header.Add("Signaturemethod", method) } func md5Hex(data []byte) string { - md5Sum := md5.Sum(data) - return hex.EncodeToString(md5Sum[:]) + md5Sum := md5.Sum(data) + return hex.EncodeToString(md5Sum[:]) } func getSignRaw(values url.Values, method string, secret string) string { - return secret + "&" + keySignInput(values, method) + return secret + "&" + keySignInput(values, method) } func keySignInput(values url.Values, method string) string { - keys := make([]string, 0) - for s, _ := range values { - keys = append(keys, s) - } - sort.Strings(keys) - - stringToSign := method + "&" + encodeURLComponent("/") - - strs := make([]string, 0) - for _, k := range keys { - strs = append(strs, k+"="+encodeURLComponent(values.Get(k))) - } - return stringToSign + "&" + encodeURLComponent(strings.Join(strs, "&")) + keys := make([]string, 0) + for s, _ := range values { + keys = append(keys, s) + } + sort.Strings(keys) + + stringToSign := method + "&" + encodeURLComponent("/") + + strs := make([]string, 0) + for _, k := range keys { + strs = append(strs, k+"="+encodeURLComponent(values.Get(k))) + } + return stringToSign + "&" + encodeURLComponent(strings.Join(strs, "&")) } func encodeURLComponent(str string) string { - escape := url.QueryEscape(str) - escape = strings.ReplaceAll(escape, "+", "%20") - escape = strings.ReplaceAll(escape, "*", "%2A") - escape = strings.ReplaceAll(escape, "%7E", "~") - return escape + escape := url.QueryEscape(str) + escape = strings.ReplaceAll(escape, "+", "%20") + escape = strings.ReplaceAll(escape, "*", "%2A") + escape = strings.ReplaceAll(escape, "%7E", "~") + return escape } func randNonce(n int) string { - b := make([]byte, n) - rand.Read(b) - return hex.EncodeToString(b) + b := make([]byte, n) + rand.Read(b) + return hex.EncodeToString(b) } // GenericError Provides access to the body, error and model on returned errors. @@ -418,14 +417,14 @@ func (e GenericError) Model() interface{} { } type Configuration struct { - Host string `json:"host"` - Scheme string `json:"scheme"` - DefaultHeader map[string]string `json:"defaultHeader,omitempty"` - AccessKey string `json:"accessKey"` - SecretKey string `json:"secretKey"` - SignatureVersion string `json:"signatureVersion"` - SignatureMethod string `json:"signatureMethod"` - HTTPClient *http.Client + Host string `json:"host"` + Scheme string `json:"scheme"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + AccessKey string `json:"accessKey"` + SecretKey string `json:"secretKey"` + SignatureVersion string `json:"signatureVersion"` + SignatureMethod string `json:"signatureMethod"` + HTTPClient *http.Client } func NewConfiguration() *Configuration { @@ -435,4 +434,4 @@ func NewConfiguration() *Configuration { SignatureMethod: "MD5", HTTPClient: http.DefaultClient, } -} \ No newline at end of file +} diff --git a/client/api/console_admin_api.go b/client/api/console_admin_api.go index 7645360b..16c6907a 100644 --- a/client/api/console_admin_api.go +++ b/client/api/console_admin_api.go @@ -17,6 +17,85 @@ import ( type ConsoleAdminApiService service +// ActivateDeployment +/* + * 激活已部署成功的游戏版本的部署 + * @param varForms model.ConsoleAdminActivateDeploymentForms + */ +func (s *ConsoleAdminApiService) ActivateDeployment( + varForms *model.ConsoleAdminActivateDeploymentForms, +) (model.ConsoleAdminActivateDeploymentResult, *http.Response, error) { + var ( + varHttpMethod = strings.ToUpper("Post") + varReturnValue model.ConsoleAdminActivateDeploymentResult + ) + + // create path and map variables + varPath := s.client.cfg.Scheme + "://" + s.client.cfg.Host + "/consoleAdmin/activateDeployment" + + 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 + } + varFormParams.Add("gameId", parameterToString(varForms.GameId, "")) + varFormParams.Add("projectId", parameterToString(varForms.ProjectId, "")) + varFormParams.Add("versionId", parameterToString(varForms.VersionId, "")) + if varForms != nil && varForms.MaxConcurrency != nil { + varFormParams.Add("maxConcurrency", parameterToString(*varForms.MaxConcurrency, "")) + } + + 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 +} + // AdaptGameVersion /* * 发起游戏版本适配 @@ -685,6 +764,236 @@ func (s *ConsoleAdminApiService) GetGameVersionProgress( return varReturnValue, varHttpResponse, nil } +// ListActivateableInstances +/* + * 指定项目和游戏版本,获取可激活且可调度的实例及调度配置 + * @param varForms model.ConsoleAdminListActivateableInstancesForms + */ +func (s *ConsoleAdminApiService) ListActivateableInstances( + varForms *model.ConsoleAdminListActivateableInstancesForms, +) (model.ConsoleAdminListActivateableInstancesResult, *http.Response, error) { + var ( + varHttpMethod = strings.ToUpper("Post") + varReturnValue model.ConsoleAdminListActivateableInstancesResult + ) + + // create path and map variables + varPath := s.client.cfg.Scheme + "://" + s.client.cfg.Host + "/consoleAdmin/listActivateableInstances" + + 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 + } + varFormParams.Add("projectId", parameterToString(varForms.ProjectId, "")) + varFormParams.Add("versionId", parameterToString(varForms.VersionId, "")) + + 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 +} + +// ListActivatedInstances +/* + * 指定项目和游戏,获取已激活版本的可调度实例及调度配置 + * @param varForms model.ConsoleAdminListActivatedInstancesForms + */ +func (s *ConsoleAdminApiService) ListActivatedInstances( + varForms *model.ConsoleAdminListActivatedInstancesForms, +) (model.ConsoleAdminListActivatedInstancesResult, *http.Response, error) { + var ( + varHttpMethod = strings.ToUpper("Post") + varReturnValue model.ConsoleAdminListActivatedInstancesResult + ) + + // create path and map variables + varPath := s.client.cfg.Scheme + "://" + s.client.cfg.Host + "/consoleAdmin/listActivatedInstances" + + 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 + } + varFormParams.Add("gameId", parameterToString(varForms.GameId, "")) + 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 +} + +// ListControllersOfGame +/* + * 获取单个游戏关联的控制器列表 + * @param varForms model.ConsoleAdminListControllersOfGameForms + */ +func (s *ConsoleAdminApiService) ListControllersOfGame( + varForms *model.ConsoleAdminListControllersOfGameForms, +) (model.ConsoleAdminListControllersOfGameResult, *http.Response, error) { + var ( + varHttpMethod = strings.ToUpper("Post") + varReturnValue model.ConsoleAdminListControllersOfGameResult + ) + + // create path and map variables + varPath := s.client.cfg.Scheme + "://" + s.client.cfg.Host + "/consoleAdmin/listControllersOfGame" + + 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 + } + varFormParams.Add("gameId", parameterToString(varForms.GameId, "")) + if varForms != nil && varForms.NextToken != nil { + varFormParams.Add("nextToken", parameterToString(*varForms.NextToken, "")) + } + if varForms != nil && varForms.MaxResults != nil { + varFormParams.Add("maxResults", parameterToString(*varForms.MaxResults, "")) + } + + 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 +} + // ListDeployableInstances /* * 指定项目和游戏版本,获取可以部署的实例 diff --git a/client/model/consoleadminactivatedeploymentforms.go b/client/model/consoleadminactivatedeploymentforms.go new file mode 100644 index 00000000..b861eaa8 --- /dev/null +++ b/client/model/consoleadminactivatedeploymentforms.go @@ -0,0 +1,18 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminActivateDeploymentForms struct { + // 游戏id + GameId string `json:"gameId"` + // 项目id + ProjectId string `json:"projectId"` + // 版本id + VersionId string `json:"versionId"` + // 期望的激活后可调度的总最大并发数不小于该参数 + MaxConcurrency *int32 `json:"maxConcurrency,omitempty"` +} diff --git a/client/model/consoleadminactivatedeploymentresult.go b/client/model/consoleadminactivatedeploymentresult.go new file mode 100644 index 00000000..a45233e1 --- /dev/null +++ b/client/model/consoleadminactivatedeploymentresult.go @@ -0,0 +1,17 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminActivateDeploymentResult struct { + // 服务端状态码 + MsgCode string `json:"msgCode,omitempty"` + // 服务端描述信息 + MsgInfo string `json:"msgInfo,omitempty"` + // 是否成功 + Success bool `json:"success,omitempty"` + Model ConsoleAdminActivateDeploymentResultModel `json:"model,omitempty"` +} diff --git a/client/model/consoleadminactivatedeploymentresultmodel.go b/client/model/consoleadminactivatedeploymentresultmodel.go new file mode 100644 index 00000000..c527a7e9 --- /dev/null +++ b/client/model/consoleadminactivatedeploymentresultmodel.go @@ -0,0 +1,12 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminActivateDeploymentResultModel struct { + // 激活结果 + Activated bool `json:"activated,omitempty"` +} diff --git a/client/model/consoleadminlistactivateableinstancesforms.go b/client/model/consoleadminlistactivateableinstancesforms.go new file mode 100644 index 00000000..7b1cc8ea --- /dev/null +++ b/client/model/consoleadminlistactivateableinstancesforms.go @@ -0,0 +1,14 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminListActivateableInstancesForms struct { + // 项目id + ProjectId string `json:"projectId"` + // 版本id + VersionId string `json:"versionId"` +} diff --git a/client/model/consoleadminlistactivateableinstancesresult.go b/client/model/consoleadminlistactivateableinstancesresult.go new file mode 100644 index 00000000..1b76c86b --- /dev/null +++ b/client/model/consoleadminlistactivateableinstancesresult.go @@ -0,0 +1,17 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminListActivateableInstancesResult struct { + // 服务端状态码 + MsgCode string `json:"msgCode,omitempty"` + // 服务端描述信息 + MsgInfo string `json:"msgInfo,omitempty"` + // 是否成功 + Success bool `json:"success,omitempty"` + Model ConsoleAdminListActivateableInstancesResultModel `json:"model,omitempty"` +} diff --git a/client/model/consoleadminlistactivateableinstancesresultmodel.go b/client/model/consoleadminlistactivateableinstancesresultmodel.go new file mode 100644 index 00000000..d1c6d0df --- /dev/null +++ b/client/model/consoleadminlistactivateableinstancesresultmodel.go @@ -0,0 +1,14 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminListActivateableInstancesResultModel struct { + // 总记录数 + Count int64 `json:"count,omitempty"` + // 数据列表 + DataList []ConsoleAdminListActivateableInstancesResultModelDataList `json:"dataList,omitempty"` +} diff --git a/client/model/consoleadminlistactivateableinstancesresultmodeldatalist.go b/client/model/consoleadminlistactivateableinstancesresultmodeldatalist.go new file mode 100644 index 00000000..e2a8dd0f --- /dev/null +++ b/client/model/consoleadminlistactivateableinstancesresultmodeldatalist.go @@ -0,0 +1,18 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminListActivateableInstancesResultModelDataList struct { + // 实例ID + CloudGameInstanceId string `json:"cloudGameInstanceId,omitempty"` + // 实例名成 + CloudGameInstanceName string `json:"cloudGameInstanceName,omitempty"` + // 实例路数 + ContainerCount int32 `json:"containerCount,omitempty"` + // 最大并发数 + MaxConcurrency int32 `json:"maxConcurrency,omitempty"` +} diff --git a/client/model/consoleadminlistactivatedinstancesforms.go b/client/model/consoleadminlistactivatedinstancesforms.go new file mode 100644 index 00000000..f3f6f778 --- /dev/null +++ b/client/model/consoleadminlistactivatedinstancesforms.go @@ -0,0 +1,14 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminListActivatedInstancesForms struct { + // 游戏id + GameId string `json:"gameId"` + // 项目id + ProjectId string `json:"projectId"` +} diff --git a/client/model/consoleadminlistactivatedinstancesresult.go b/client/model/consoleadminlistactivatedinstancesresult.go new file mode 100644 index 00000000..c1bfb6ce --- /dev/null +++ b/client/model/consoleadminlistactivatedinstancesresult.go @@ -0,0 +1,17 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminListActivatedInstancesResult struct { + // 服务端状态码 + MsgCode string `json:"msgCode,omitempty"` + // 服务端描述信息 + MsgInfo string `json:"msgInfo,omitempty"` + // 是否成功 + Success bool `json:"success,omitempty"` + Model ConsoleAdminListActivatedInstancesResultModel `json:"model,omitempty"` +} diff --git a/client/model/consoleadminlistactivatedinstancesresultmodel.go b/client/model/consoleadminlistactivatedinstancesresultmodel.go new file mode 100644 index 00000000..57fe2d73 --- /dev/null +++ b/client/model/consoleadminlistactivatedinstancesresultmodel.go @@ -0,0 +1,14 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminListActivatedInstancesResultModel struct { + // 总记录数 + Count int64 `json:"count,omitempty"` + // 数据列表 + DataList []ConsoleAdminListActivatedInstancesResultModelDataList `json:"dataList,omitempty"` +} diff --git a/client/model/consoleadminlistactivatedinstancesresultmodeldatalist.go b/client/model/consoleadminlistactivatedinstancesresultmodeldatalist.go new file mode 100644 index 00000000..e3031c00 --- /dev/null +++ b/client/model/consoleadminlistactivatedinstancesresultmodeldatalist.go @@ -0,0 +1,18 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminListActivatedInstancesResultModelDataList struct { + // 实例ID + CloudGameInstanceId string `json:"cloudGameInstanceId,omitempty"` + // 实例名成 + CloudGameInstanceName string `json:"cloudGameInstanceName,omitempty"` + // 实例路数 + ContainerCount int32 `json:"containerCount,omitempty"` + // 最大并发数 + MaxConcurrency int32 `json:"maxConcurrency,omitempty"` +} diff --git a/client/model/consoleadminlistcontrollersofgameforms.go b/client/model/consoleadminlistcontrollersofgameforms.go new file mode 100644 index 00000000..60915df8 --- /dev/null +++ b/client/model/consoleadminlistcontrollersofgameforms.go @@ -0,0 +1,16 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminListControllersOfGameForms struct { + // 游戏id + GameId string `json:"gameId"` + // 标记当前开始读取的位置 + NextToken *string `json:"nextToken,omitempty"` + // 本次读取的最大数据记录数量 + MaxResults *string `json:"maxResults,omitempty"` +} diff --git a/client/model/consoleadminlistcontrollersofgameresult.go b/client/model/consoleadminlistcontrollersofgameresult.go new file mode 100644 index 00000000..431a1cf8 --- /dev/null +++ b/client/model/consoleadminlistcontrollersofgameresult.go @@ -0,0 +1,17 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminListControllersOfGameResult struct { + // 服务端状态码 + MsgCode string `json:"msgCode,omitempty"` + // 服务端描述信息 + MsgInfo string `json:"msgInfo,omitempty"` + // 是否成功 + Success bool `json:"success,omitempty"` + Model ConsoleAdminListControllersOfGameResultModel `json:"model,omitempty"` +} diff --git a/client/model/consoleadminlistcontrollersofgameresultmodel.go b/client/model/consoleadminlistcontrollersofgameresultmodel.go new file mode 100644 index 00000000..d7e1486a --- /dev/null +++ b/client/model/consoleadminlistcontrollersofgameresultmodel.go @@ -0,0 +1,18 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminListControllersOfGameResultModel struct { + // 总记录数 + Count int64 `json:"count,omitempty"` + // 表示当前调用返回读取到的位置,空代表数据已经读取完毕 + NextToken string `json:"nextToken,omitempty"` + // 本次请求所返回的最大记录条数 + MaxResults int32 `json:"maxResults,omitempty"` + // 数据列表 + DataList []ConsoleAdminListControllersOfGameResultModelDataList `json:"dataList,omitempty"` +} diff --git a/client/model/consoleadminlistcontrollersofgameresultmodeldatalist.go b/client/model/consoleadminlistcontrollersofgameresultmodeldatalist.go new file mode 100644 index 00000000..c569f4d2 --- /dev/null +++ b/client/model/consoleadminlistcontrollersofgameresultmodeldatalist.go @@ -0,0 +1,24 @@ +// Package client +/* + * YuanJing OpenAPI SDK for Go + * + * + */ +package model + +type ConsoleAdminListControllersOfGameResultModelDataList struct { + // 控制器ID + Id string `json:"id,omitempty"` + // 名称 + Name string `json:"name,omitempty"` + // 背景图 + BgPic string `json:"bgPic,omitempty"` + // 配置 + Config string `json:"config,omitempty"` + // 方案类型 + Type_ int32 `json:"type,omitempty"` + // 控制器类型 + Ctltype string `json:"ctltype,omitempty"` + // 优先级 + Priority int32 `json:"priority,omitempty"` +}