Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
939b9629
Commit
939b9629
authored
Apr 14, 2017
by
Cao Shufeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor code from restful namer
Some codes are replaced because they will never run.
parent
eda8e127
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
namer.go
staging/src/k8s.io/apiserver/pkg/endpoints/handlers/namer.go
+7
-10
No files found.
staging/src/k8s.io/apiserver/pkg/endpoints/handlers/namer.go
View file @
939b9629
...
@@ -46,7 +46,7 @@ type ScopeNamer interface {
...
@@ -46,7 +46,7 @@ type ScopeNamer interface {
// GenerateLink creates an encoded URI for a given runtime object that represents the canonical path
// GenerateLink creates an encoded URI for a given runtime object that represents the canonical path
// and query.
// and query.
GenerateLink
(
req
*
http
.
Request
,
obj
runtime
.
Object
)
(
uri
string
,
err
error
)
GenerateLink
(
req
*
http
.
Request
,
obj
runtime
.
Object
)
(
uri
string
,
err
error
)
// GenerateLink creates an encoded URI for a list that represents the canonical path and query.
// GenerateLi
stLi
nk creates an encoded URI for a list that represents the canonical path and query.
GenerateListLink
(
req
*
http
.
Request
)
(
uri
string
,
err
error
)
GenerateListLink
(
req
*
http
.
Request
)
(
uri
string
,
err
error
)
}
}
...
@@ -91,22 +91,19 @@ func (n ContextBasedNaming) Name(req *http.Request) (namespace, name string, err
...
@@ -91,22 +91,19 @@ func (n ContextBasedNaming) Name(req *http.Request) (namespace, name string, err
}
}
func
(
n
ContextBasedNaming
)
GenerateLink
(
req
*
http
.
Request
,
obj
runtime
.
Object
)
(
uri
string
,
err
error
)
{
func
(
n
ContextBasedNaming
)
GenerateLink
(
req
*
http
.
Request
,
obj
runtime
.
Object
)
(
uri
string
,
err
error
)
{
namespace
,
name
,
err
:=
n
.
ObjectName
(
obj
)
if
err
!=
nil
{
return
""
,
err
}
requestInfo
,
ok
:=
request
.
RequestInfoFrom
(
n
.
GetContext
(
req
))
requestInfo
,
ok
:=
request
.
RequestInfoFrom
(
n
.
GetContext
(
req
))
if
!
ok
{
if
!
ok
{
return
""
,
fmt
.
Errorf
(
"missing requestInfo"
)
return
""
,
fmt
.
Errorf
(
"missing requestInfo"
)
}
}
if
len
(
namespace
)
==
0
&&
len
(
name
)
==
0
{
namespace
,
name
,
err
:=
n
.
ObjectName
(
obj
)
if
len
(
requestInfo
.
Name
)
==
0
{
if
err
==
errEmptyName
&&
len
(
requestInfo
.
Name
)
>
0
{
return
""
,
errEmptyName
name
=
requestInfo
.
Name
}
else
if
err
!=
nil
{
return
""
,
err
}
}
if
len
(
namespace
)
==
0
&&
len
(
requestInfo
.
Namespace
)
>
0
{
namespace
=
requestInfo
.
Namespace
namespace
=
requestInfo
.
Namespace
name
=
requestInfo
.
Name
}
}
if
n
.
ClusterScoped
{
if
n
.
ClusterScoped
{
...
...
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