forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildinstantiatebinary.go
37 lines (30 loc) · 987 Bytes
/
buildinstantiatebinary.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
package internalversion
import (
"io"
rest "k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/api/legacyscheme"
buildapi "github.com/openshift/origin/pkg/build/apis/build"
)
type BuildInstantiateBinaryInterface interface {
InstantiateBinary(name string, options *buildapi.BinaryBuildRequestOptions, r io.Reader) (*buildapi.Build, error)
}
func NewBuildInstantiateBinaryClient(c rest.Interface, ns string) BuildInstantiateBinaryInterface {
return &buildInstatiateBinary{client: c, ns: ns}
}
type buildInstatiateBinary struct {
client rest.Interface
ns string
}
func (c *buildInstatiateBinary) InstantiateBinary(name string, options *buildapi.BinaryBuildRequestOptions, r io.Reader) (*buildapi.Build, error) {
result := &buildapi.Build{}
err := c.client.Post().
Namespace(c.ns).
Resource("buildconfigs").
Name(name).
SubResource("instantiatebinary").
Body(r).
VersionedParams(options, legacyscheme.ParameterCodec).
Do().
Into(result)
return result, err
}