Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
goSDN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
goSDN
Commits
319f6ed5
Commit
319f6ed5
authored
7 months ago
by
Fabian Seidl
Browse files
Options
Downloads
Patches
Plain Diff
add client api for add, get, delete
parent
26572909
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
controller/api/subManagement.go
+46
-0
46 additions, 0 deletions
controller/api/subManagement.go
with
46 additions
and
0 deletions
controller/api/subManagement.go
+
46
−
0
View file @
319f6ed5
...
...
@@ -35,3 +35,49 @@ func GetAll(ctx context.Context, addr string) (*subpb.GetAllResponse, error) {
return
subClient
.
GetAll
(
ctx
,
req
)
}
// Get fetches detailed info for one specific available subscription.
func
Get
(
ctx
context
.
Context
,
addr
string
,
subID
string
)
(
*
subpb
.
GetResponse
,
error
)
{
subClient
,
err
:=
nbi
.
SubManagementClient
(
addr
,
dialOptions
...
)
if
err
!=
nil
{
return
nil
,
err
}
req
:=
&
subpb
.
GetRequest
{
Timestamp
:
time
.
Now
()
.
UnixNano
(),
Subid
:
subID
,
}
return
subClient
.
Get
(
ctx
,
req
)
}
// Delete stops and removes one specific running subscription is a no-op if object connected to ID does not exist.
func
Delete
(
ctx
context
.
Context
,
addr
string
,
subID
string
)
(
*
subpb
.
DeleteResponse
,
error
)
{
subClient
,
err
:=
nbi
.
SubManagementClient
(
addr
,
dialOptions
...
)
if
err
!=
nil
{
return
nil
,
err
}
req
:=
&
subpb
.
DeleteRequest
{
Timestamp
:
time
.
Now
()
.
UnixNano
(),
Subid
:
subID
,
}
return
subClient
.
Delete
(
ctx
,
req
)
}
// Add creates a new subscription for the network element matching the provided ID using the provided subscribe options.
func
Add
(
ctx
context
.
Context
,
addr
string
,
mneID
string
,
subscribeOptions
*
subpb
.
Subscription
)
(
*
subpb
.
AddResponse
,
error
)
{
subClient
,
err
:=
nbi
.
SubManagementClient
(
addr
,
dialOptions
...
)
if
err
!=
nil
{
return
nil
,
err
}
req
:=
&
subpb
.
AddRequest
{
Timestamp
:
time
.
Now
()
.
UnixNano
(),
Mneid
:
mneID
,
Subscription
:
subscribeOptions
,
}
return
subClient
.
Add
(
ctx
,
req
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment