Commit 663098df authored by 张醒狮's avatar 张醒狮

已删除.idea/dictionaries/project.xml, .idea/.gitignore, .idea/guidon-client.iml,...

已删除.idea/dictionaries/project.xml, .idea/.gitignore, .idea/guidon-client.iml, .idea/modules.xml, .idea/vcs.xml, client/resource_center.go
parent 59f5ce38
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<component name="ProjectDictionaryState">
<dictionary name="project">
<words>
<w>publicsource</w>
</words>
</dictionary>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/guidon-client.iml" filepath="$PROJECT_DIR$/.idea/guidon-client.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
package client
import (
"context"
"git.zmcms.cn/publicsource/guidon-client/pb"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"time"
)
type ResourceCenterClient struct {
conn *grpc.ClientConn
client pb.ResourceCenterClient
}
func NewResourceCenterClient(addr string) (*ResourceCenterClient, error) {
conn, err := grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return nil, err
}
return &ResourceCenterClient{conn: conn, client: pb.NewResourceCenterClient(conn)}, nil
}
func (rc *ResourceCenterClient) Close() error {
return rc.conn.Close()
}
func (rc *ResourceCenterClient) GetOwnership(ctx context.Context, resourceId string) (*pb.OwnershipResponse, error) {
req := &pb.OwnershipRequest{InstanceId: resourceId}
ctx, cancel := context.WithTimeout(ctx, 3*time.Second)
defer cancel()
return rc.client.GetOwnership(ctx, req)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment