forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprojectrequests.go
44 lines (36 loc) · 1.33 KB
/
projectrequests.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
projectapi "github.com/openshift/origin/pkg/project/api"
)
// ProjectRequestsInterface has methods to work with ProjectRequest resources in a namespace
type ProjectRequestsInterface interface {
ProjectRequests() ProjectRequestInterface
}
// ProjectRequestInterface exposes methods on projectRequest resources.
type ProjectRequestInterface interface {
Create(p *projectapi.ProjectRequest) (*projectapi.Project, error)
List(opts kapi.ListOptions) (*unversioned.Status, error)
}
type projectRequests struct {
r *Client
}
// newUsers returns a users
func newProjectRequests(c *Client) *projectRequests {
return &projectRequests{
r: c,
}
}
// Create creates a new Project
func (c *projectRequests) Create(p *projectapi.ProjectRequest) (result *projectapi.Project, err error) {
result = &projectapi.Project{}
err = c.r.Post().Resource("projectRequests").Body(p).Do().Into(result)
return
}
// List returns a status object indicating that a user can call the Create or an error indicating why not
func (c *projectRequests) List(opts kapi.ListOptions) (result *unversioned.Status, err error) {
result = &unversioned.Status{}
err = c.r.Get().Resource("projectRequests").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return result, err
}