Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
guidon-client
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PublicSource
guidon-client
Commits
478c5151
Commit
478c5151
authored
Oct 09, 2025
by
张醒狮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add GetMajorOwnership function
parent
d51d1bd9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
24 deletions
+36
-24
resource_center.go
client/resource_center.go
+12
-0
resource.pb.go
pb/resource.pb.go
+22
-22
resource.proto
pb/resource.proto
+2
-2
No files found.
client/resource_center.go
View file @
478c5151
...
...
@@ -34,6 +34,18 @@ func (rc *ResourceCenterClient) GetOwnership(ctx context.Context, resourceId str
return
rc
.
Client
.
GetOwnership
(
ctx
,
req
)
}
func
(
rc
*
ResourceCenterClient
)
GetMajorOwnership
(
ctx
context
.
Context
,
resourceId
string
)
(
*
pb
.
Organ
,
error
)
{
organ
:=
&
pb
.
Organ
{
Team
:
"质量运维部"
,
Group
:
"运维保障组"
}
response
,
err
:=
rc
.
GetOwnership
(
ctx
,
resourceId
)
if
err
!=
nil
{
return
nil
,
err
}
if
response
.
Mode
>
0
{
organ
=
response
.
Items
[
0
]
}
return
organ
,
nil
}
func
(
rc
*
ResourceCenterClient
)
SearchAsset
(
ctx
context
.
Context
,
resourceType
string
,
opts
...
Option
)
(
*
pb
.
AssetResponse
,
error
)
{
req
:=
&
pb
.
AssetRequest
{
ResourceType
:
resourceType
}
...
...
pb/resource.pb.go
View file @
478c5151
...
...
@@ -67,7 +67,7 @@ func (x *OwnershipRequest) GetInstanceId() string {
return
""
}
type
Items
struct
{
type
Organ
struct
{
state
protoimpl
.
MessageState
sizeCache
protoimpl
.
SizeCache
unknownFields
protoimpl
.
UnknownFields
...
...
@@ -80,8 +80,8 @@ type Items struct {
AppId
string
`protobuf:"bytes,6,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
}
func
(
x
*
Items
)
Reset
()
{
*
x
=
Items
{}
func
(
x
*
Organ
)
Reset
()
{
*
x
=
Organ
{}
if
protoimpl
.
UnsafeEnabled
{
mi
:=
&
file_pb_resource_proto_msgTypes
[
1
]
ms
:=
protoimpl
.
X
.
MessageStateOf
(
protoimpl
.
Pointer
(
x
))
...
...
@@ -89,13 +89,13 @@ func (x *Items) Reset() {
}
}
func
(
x
*
Items
)
String
()
string
{
func
(
x
*
Organ
)
String
()
string
{
return
protoimpl
.
X
.
MessageStringOf
(
x
)
}
func
(
*
Items
)
ProtoMessage
()
{}
func
(
*
Organ
)
ProtoMessage
()
{}
func
(
x
*
Items
)
ProtoReflect
()
protoreflect
.
Message
{
func
(
x
*
Organ
)
ProtoReflect
()
protoreflect
.
Message
{
mi
:=
&
file_pb_resource_proto_msgTypes
[
1
]
if
protoimpl
.
UnsafeEnabled
&&
x
!=
nil
{
ms
:=
protoimpl
.
X
.
MessageStateOf
(
protoimpl
.
Pointer
(
x
))
...
...
@@ -107,47 +107,47 @@ func (x *Items) ProtoReflect() protoreflect.Message {
return
mi
.
MessageOf
(
x
)
}
// Deprecated: Use
Items
.ProtoReflect.Descriptor instead.
func
(
*
Items
)
Descriptor
()
([]
byte
,
[]
int
)
{
// Deprecated: Use
Organ
.ProtoReflect.Descriptor instead.
func
(
*
Organ
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
file_pb_resource_proto_rawDescGZIP
(),
[]
int
{
1
}
}
func
(
x
*
Items
)
GetTeam
()
string
{
func
(
x
*
Organ
)
GetTeam
()
string
{
if
x
!=
nil
{
return
x
.
Team
}
return
""
}
func
(
x
*
Items
)
GetTeamId
()
string
{
func
(
x
*
Organ
)
GetTeamId
()
string
{
if
x
!=
nil
{
return
x
.
TeamId
}
return
""
}
func
(
x
*
Items
)
GetGroup
()
string
{
func
(
x
*
Organ
)
GetGroup
()
string
{
if
x
!=
nil
{
return
x
.
Group
}
return
""
}
func
(
x
*
Items
)
GetGroupId
()
string
{
func
(
x
*
Organ
)
GetGroupId
()
string
{
if
x
!=
nil
{
return
x
.
GroupId
}
return
""
}
func
(
x
*
Items
)
GetApp
()
string
{
func
(
x
*
Organ
)
GetApp
()
string
{
if
x
!=
nil
{
return
x
.
App
}
return
""
}
func
(
x
*
Items
)
GetAppId
()
string
{
func
(
x
*
Organ
)
GetAppId
()
string
{
if
x
!=
nil
{
return
x
.
AppId
}
...
...
@@ -159,7 +159,7 @@ type OwnershipResponse struct {
sizeCache
protoimpl
.
SizeCache
unknownFields
protoimpl
.
UnknownFields
Items
[]
*
Items
`protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
Items
[]
*
Organ
`protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
Mode
int32
`protobuf:"varint,2,opt,name=mode,proto3" json:"mode,omitempty"`
}
...
...
@@ -195,7 +195,7 @@ func (*OwnershipResponse) Descriptor() ([]byte, []int) {
return
file_pb_resource_proto_rawDescGZIP
(),
[]
int
{
2
}
}
func
(
x
*
OwnershipResponse
)
GetItems
()
[]
*
Items
{
func
(
x
*
OwnershipResponse
)
GetItems
()
[]
*
Organ
{
if
x
!=
nil
{
return
x
.
Items
}
...
...
@@ -446,7 +446,7 @@ var file_pb_resource_proto_rawDesc = []byte{
0x77
,
0x6e
,
0x65
,
0x72
,
0x73
,
0x68
,
0x69
,
0x70
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x12
,
0x1f
,
0x0a
,
0x0b
,
0x69
,
0x6e
,
0x73
,
0x74
,
0x61
,
0x6e
,
0x63
,
0x65
,
0x5f
,
0x69
,
0x64
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x0a
,
0x69
,
0x6e
,
0x73
,
0x74
,
0x61
,
0x6e
,
0x63
,
0x65
,
0x49
,
0x64
,
0x22
,
0x8e
,
0x01
,
0x0a
,
0x05
,
0x
69
,
0x74
,
0x65
,
0x6d
,
0x73
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x74
,
0x65
,
0x22
,
0x8e
,
0x01
,
0x0a
,
0x05
,
0x
4f
,
0x72
,
0x67
,
0x61
,
0x6e
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x74
,
0x65
,
0x61
,
0x6d
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x04
,
0x74
,
0x65
,
0x61
,
0x6d
,
0x12
,
0x17
,
0x0a
,
0x07
,
0x74
,
0x65
,
0x61
,
0x6d
,
0x5f
,
0x69
,
0x64
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x74
,
0x65
,
0x61
,
0x6d
,
0x49
,
0x64
,
0x12
,
0x14
,
0x0a
,
0x05
,
0x67
,
0x72
,
0x6f
,
0x75
,
0x70
,
...
...
@@ -457,8 +457,8 @@ var file_pb_resource_proto_rawDesc = []byte{
0x70
,
0x5f
,
0x69
,
0x64
,
0x18
,
0x06
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x05
,
0x61
,
0x70
,
0x70
,
0x49
,
0x64
,
0x22
,
0x4c
,
0x0a
,
0x11
,
0x4f
,
0x77
,
0x6e
,
0x65
,
0x72
,
0x73
,
0x68
,
0x69
,
0x70
,
0x52
,
0x65
,
0x73
,
0x70
,
0x6f
,
0x6e
,
0x73
,
0x65
,
0x12
,
0x23
,
0x0a
,
0x05
,
0x69
,
0x74
,
0x65
,
0x6d
,
0x73
,
0x18
,
0x01
,
0x20
,
0x03
,
0x28
,
0x0b
,
0x32
,
0x0d
,
0x2e
,
0x67
,
0x75
,
0x69
,
0x64
,
0x6f
,
0x6e
,
0x2e
,
0x
69
,
0x7
4
,
0x65
,
0x6d
,
0x73
,
0x52
,
0x05
,
0x69
,
0x74
,
0x65
,
0x6d
,
0x73
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x6d
,
0x01
,
0x20
,
0x03
,
0x28
,
0x0b
,
0x32
,
0x0d
,
0x2e
,
0x67
,
0x75
,
0x69
,
0x64
,
0x6f
,
0x6e
,
0x2e
,
0x
4f
,
0x7
2
,
0x67
,
0x61
,
0x6e
,
0x52
,
0x05
,
0x69
,
0x74
,
0x65
,
0x6d
,
0x73
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x6d
,
0x6f
,
0x64
,
0x65
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x05
,
0x52
,
0x04
,
0x6d
,
0x6f
,
0x64
,
0x65
,
0x22
,
0xf1
,
0x01
,
0x0a
,
0x0c
,
0x41
,
0x73
,
0x73
,
0x65
,
0x74
,
0x52
,
0x65
,
0x71
,
0x75
,
0x65
,
0x73
,
0x74
,
0x12
,
0x23
,
0x0a
,
0x0d
,
0x72
,
0x65
,
0x73
,
0x6f
,
0x75
,
0x72
,
0x63
,
0x65
,
0x5f
,
0x6e
,
0x61
,
0x6d
,
...
...
@@ -520,14 +520,14 @@ func file_pb_resource_proto_rawDescGZIP() []byte {
var
file_pb_resource_proto_msgTypes
=
make
([]
protoimpl
.
MessageInfo
,
6
)
var
file_pb_resource_proto_goTypes
=
[]
interface
{}{
(
*
OwnershipRequest
)(
nil
),
// 0: guidon.OwnershipRequest
(
*
Items
)(
nil
),
// 1: guidon.items
(
*
Organ
)(
nil
),
// 1: guidon.Organ
(
*
OwnershipResponse
)(
nil
),
// 2: guidon.OwnershipResponse
(
*
AssetRequest
)(
nil
),
// 3: guidon.AssetRequest
(
*
AssetResponse
)(
nil
),
// 4: guidon.AssetResponse
(
*
AssertInfo
)(
nil
),
// 5: guidon.AssertInfo
}
var
file_pb_resource_proto_depIdxs
=
[]
int32
{
1
,
// 0: guidon.OwnershipResponse.items:type_name -> guidon.
items
1
,
// 0: guidon.OwnershipResponse.items:type_name -> guidon.
Organ
5
,
// 1: guidon.AssetResponse.items:type_name -> guidon.AssertInfo
0
,
// 2: guidon.ResourceCenter.GetOwnership:input_type -> guidon.OwnershipRequest
3
,
// 3: guidon.ResourceCenter.SearchAsset:input_type -> guidon.AssetRequest
...
...
@@ -559,7 +559,7 @@ func file_pb_resource_proto_init() {
}
}
file_pb_resource_proto_msgTypes
[
1
]
.
Exporter
=
func
(
v
interface
{},
i
int
)
interface
{}
{
switch
v
:=
v
.
(
*
Items
);
i
{
switch
v
:=
v
.
(
*
Organ
);
i
{
case
0
:
return
&
v
.
state
case
1
:
...
...
pb/resource.proto
View file @
478c5151
...
...
@@ -7,7 +7,7 @@ message OwnershipRequest {
string
instance_id
=
1
;
}
message
items
{
message
Organ
{
string
team
=
1
;
string
team_id
=
2
;
string
group
=
3
;
...
...
@@ -17,7 +17,7 @@ message items {
}
message
OwnershipResponse
{
repeated
items
items
=
1
;
repeated
Organ
items
=
1
;
int32
mode
=
2
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment