Skip to content

Commit

Permalink
Merge pull request #6 from Tencent/apimachinery
Browse files Browse the repository at this point in the history
Apimachinery
  • Loading branch information
jerry-tom committed Jun 15, 2018
2 parents 071e5c8 + b526ced commit 8954b95
Show file tree
Hide file tree
Showing 160 changed files with 6,068 additions and 2,964 deletions.
1 change: 1 addition & 0 deletions resources/language/default/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"property_is_readonly": "是否只读",
"app_not_exist":"业务不存在",
"import_row_int_error_str":"%d行%s",
"property_group":"字段分组",
"":""
}
2 changes: 1 addition & 1 deletion resources/language/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"property_is_readonly": "Read-only",
"app_not_exist": "Business does not exist",
"import_row_int_error_str":"%d row %s",

"property_group":"Field Group",
"": ""
}
2 changes: 1 addition & 1 deletion resources/language/en/host_server.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"host_agent_add_host_module_fail": "New addressee cmdb failed operation, bad belief:% s",
"host_resource_pool_not_exist": "Unresolved Resource Pool",
"host_resource_pool_get_fail": "Resource Resource Ikebana Breathless Loss, Inconsistent Relationship:% s",
"host_belong_resource_pool": "Primary machine 已 经 资源 池, 不 demand transmusion",
"host_belong_resource_pool": "The current host already belongs to the resource pool and does not need to be transferred",
"host_resource_module_get_fail": "Resource resource reservoir puzzle breathlessness, bad belief:% s",
"host_move_to_resource": "Transferred principal resource reservoir failure, incorrect belief:% s",
"host_search_module_fail_with_errmsg": "Liver machine relationship failure, intentional belief:% s",
Expand Down
6 changes: 3 additions & 3 deletions src/api_server/ccapi/actions/v3/host/userApi.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/*
* Tencent is pleased to support the open source community by making 蓝鲸 available.
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/MIT
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/

package host

import (
Expand Down
4 changes: 4 additions & 0 deletions src/api_server/ccapi/logics/v2/common/converter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ func ResToV2ForRoleApp(respV3, uin string, roleArr []string) (interface{}, error
return nil, err
}

for _, role := range roleArr {
resDataV2[role] = make([]interface{}, 0)
}

resMapDataInfoV3, ok := resDataV3.(map[string]interface{})
var resDataInfoV3 []interface{}
if true == ok {
Expand Down
29 changes: 15 additions & 14 deletions src/apimachinery/adminserver/adminserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,28 @@
package adminserver

import (
"context"
"fmt"

"configcenter/src/apimachinery/util"
"configcenter/src/apimachinery/rest"
"configcenter/src/common/core/cc/api"
"context"
"fmt"
"net/http"

"configcenter/src/apimachinery/rest"
"configcenter/src/common/metadata"
"configcenter/src/apimachinery/util"
)

type AdminServerClientInterface interface {
ClearDatabase(ctx context.Context, h util.Headers) (resp *api.BKAPIRsp, err error)
Set(ctx context.Context, h util.Headers) (resp *api.BKAPIRsp, err error)
Migrate(ctx context.Context, distribution string, h util.Headers) (resp *api.BKAPIRsp, err error)
ClearDatabase(ctx context.Context, h http.Header) (resp *metadata.Response, err error)
Set(ctx context.Context, ownerID string, h http.Header) (resp *metadata.Response, err error)
Migrate(ctx context.Context, ownerID string, distribution string, h http.Header) (resp *metadata.Response, err error)
}

func NewAdminServerClientInterface(c *util.Capability, version string) AdminServerClientInterface {
base := fmt.Sprintf("/migrate/%s", version)
return &adminServer{
client: rest.NewRESTClient(c, base),
}
base := fmt.Sprintf("/migrate/%s", version)
return &adminServer{
client: rest.NewRESTClient(c, base),
}
}

type adminServer struct {
client rest.ClientInterface
client rest.ClientInterface
}
82 changes: 41 additions & 41 deletions src/apimachinery/adminserver/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,51 +13,51 @@
package adminserver

import (
"context"
"fmt"
"configcenter/src/apimachinery/util"
"configcenter/src/common/core/cc/api"
"context"
"fmt"
"net/http"

"configcenter/src/common/metadata"
)

func(a *adminServer) ClearDatabase(ctx context.Context, h util.Headers) (resp *api.BKAPIRsp, err error) {
resp = new(api.BKAPIRsp)
subPath := "/clear"

err = a.client.Post().
WithContext(ctx).
Body(nil).
SubResource(subPath).
WithHeaders(h.ToHeader()).
Do().
Into(resp)
return
func (a *adminServer) ClearDatabase(ctx context.Context, h http.Header) (resp *metadata.Response, err error) {
resp = new(metadata.Response)
subPath := "/clear"

err = a.client.Post().
WithContext(ctx).
Body(nil).
SubResource(subPath).
WithHeaders(h).
Do().
Into(resp)
return
}

func(a *adminServer) Set(ctx context.Context, h util.Headers) (resp *api.BKAPIRsp, err error) {
resp = new(api.BKAPIRsp)
subPath := fmt.Sprintf("/migrate/system/hostcrossbiz/%s", h.OwnerID)

err = a.client.Post().
WithContext(ctx).
Body(nil).
SubResource(subPath).
WithHeaders(h.ToHeader()).
Do().
Into(resp)
return
func (a *adminServer) Set(ctx context.Context, ownerID string, h http.Header) (resp *metadata.Response, err error) {
resp = new(metadata.Response)
subPath := fmt.Sprintf("/migrate/system/hostcrossbiz/%s", ownerID)

err = a.client.Post().
WithContext(ctx).
Body(nil).
SubResource(subPath).
WithHeaders(h).
Do().
Into(resp)
return
}

func(a *adminServer) Migrate(ctx context.Context, distribution string, h util.Headers) (resp *api.BKAPIRsp, err error) {
resp = new(api.BKAPIRsp)
subPath := fmt.Sprintf("/migrate/%s/%s", distribution, h.OwnerID)

err = a.client.Post().
WithContext(ctx).
Body(nil).
SubResource(subPath).
WithHeaders(h.ToHeader()).
Do().
Into(resp)
return
func (a *adminServer) Migrate(ctx context.Context, ownerID string, distribution string, h http.Header) (resp *metadata.Response, err error) {
resp = new(metadata.Response)
subPath := fmt.Sprintf("/migrate/%s/%s", distribution, ownerID)

err = a.client.Post().
WithContext(ctx).
Body(nil).
SubResource(subPath).
WithHeaders(h).
Do().
Into(resp)
return
}

0 comments on commit 8954b95

Please sign in to comment.