代码拉取完成,页面将自动刷新
/*
Copyright IBM Corp. 2017 All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package resourcesconfig
import (
cb "github.com/hyperledger/fabric/protos/common"
pb "github.com/hyperledger/fabric/protos/peer"
"github.com/golang/protobuf/proto"
"github.com/pkg/errors"
)
// apisGroup represents the ConfigGroup names APIs off the resources group
type apisGroup struct {
apiPolicyRefs map[string]string
}
func (ag *apisGroup) PolicyRefForAPI(apiName string) string {
return ag.apiPolicyRefs[apiName]
}
func newAPIsGroup(group *cb.ConfigGroup) (*apisGroup, error) {
if len(group.Groups) > 0 {
return nil, errors.New("apis group does not support sub-groups")
}
apiPolicyRefs := make(map[string]string)
for key, value := range group.Values {
api := &pb.APIResource{}
if err := proto.Unmarshal(value.Value, api); err != nil {
return nil, err
}
// If the policy is fully qualified, ie to /Channel/Application/Readers leave it alone
// otherwise, make it fully qualified referring to /Resources/APIs/policyName
if '/' != api.PolicyRef[0] {
apiPolicyRefs[key] = "/" + RootGroupKey + "/" + APIsGroupKey + "/" + api.PolicyRef
} else {
apiPolicyRefs[key] = api.PolicyRef
}
}
return &apisGroup{
apiPolicyRefs: apiPolicyRefs,
}, nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。