forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuildinstantiatebinary.go
37 lines (30 loc) · 948 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 v1
import (
"io"
"k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/api/legacyscheme"
buildv1 "github.com/openshift/api/build/v1"
)
type BuildInstantiateBinaryInterface interface {
InstantiateBinary(name string, options *buildv1.BinaryBuildRequestOptions, r io.Reader) (*buildv1.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 *buildv1.BinaryBuildRequestOptions, r io.Reader) (*buildv1.Build, error) {
result := &buildv1.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
}