本文整理汇总了Golang中k8s/io/kubernetes/pkg/client/unversioned/testclient.NewUpdateAction函数的典型用法代码示例。如果您正苦于以下问题:Golang NewUpdateAction函数的具体用法?Golang NewUpdateAction怎么用?Golang NewUpdateAction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewUpdateAction函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Update
func (c *FakeEgressNetworkPolicy) Update(inObj *sdnapi.EgressNetworkPolicy) (*sdnapi.EgressNetworkPolicy, error) {
obj, err := c.Fake.Invokes(ktestclient.NewUpdateAction("egressnetworkpolicies", c.Namespace, inObj), inObj)
if obj == nil {
return nil, err
}
return obj.(*sdnapi.EgressNetworkPolicy), err
}
示例2: Update
func (c *FakeBackingServiceInstances) Update(inObj *backingserviceinstanceapi.BackingServiceInstance) (*backingserviceinstanceapi.BackingServiceInstance, error) {
obj, err := c.Fake.Invokes(ktestclient.NewUpdateAction("backingserviceinstances", c.Namespace, inObj), inObj)
if obj == nil {
return nil, err
}
return obj.(*backingserviceinstanceapi.BackingServiceInstance), err
}
示例3: Update
func (c *FakeRoleBindings) Update(inObj *authorizationapi.RoleBinding) (*authorizationapi.RoleBinding, error) {
obj, err := c.Fake.Invokes(ktestclient.NewUpdateAction("rolebindings", c.Namespace, inObj), inObj)
if obj == nil {
return nil, err
}
return obj.(*authorizationapi.RoleBinding), err
}
示例4: Update
func (c *FakeDeploymentConfigs) Update(inObj *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error) {
obj, err := c.Fake.Invokes(ktestclient.NewUpdateAction("deploymentconfigs", c.Namespace, inObj), inObj)
if obj == nil {
return nil, err
}
return obj.(*deployapi.DeploymentConfig), err
}
示例5: Update
func (c *FakeBuildConfigs) Update(inObj *buildapi.BuildConfig) (*buildapi.BuildConfig, error) {
obj, err := c.Fake.Invokes(ktestclient.NewUpdateAction("buildconfigs", c.Namespace, inObj), inObj)
if obj == nil {
return nil, err
}
return obj.(*buildapi.BuildConfig), err
}
示例6: Update
func (c *FakeRoutes) Update(inObj *routeapi.Route) (*routeapi.Route, error) {
obj, err := c.Fake.Invokes(ktestclient.NewUpdateAction("routes", c.Namespace, inObj), inObj)
if obj == nil {
return nil, err
}
return obj.(*routeapi.Route), err
}
示例7: UpdateDetails
func (c *FakeBuilds) UpdateDetails(inObj *buildapi.Build) (*buildapi.Build, error) {
obj, err := c.Fake.Invokes(ktestclient.NewUpdateAction("builds/details", c.Namespace, inObj), inObj)
if obj == nil {
return nil, err
}
return obj.(*buildapi.Build), err
}
示例8: UpdateScale
func (c *FakeDeploymentConfigs) UpdateScale(inObj *extensions.Scale) (*extensions.Scale, error) {
obj, err := c.Fake.Invokes(ktestclient.NewUpdateAction("deploymentconfigs/scale", c.Namespace, inObj), inObj)
if obj == nil {
return nil, err
}
return obj.(*extensions.Scale), err
}
示例9: Update
func (c *FakeImageStreamTags) Update(inObj *imageapi.ImageStreamTag) (*imageapi.ImageStreamTag, error) {
obj, err := c.Fake.Invokes(ktestclient.NewUpdateAction("imagestreamtags", c.Namespace, inObj), inObj)
if obj == nil {
return nil, err
}
return obj.(*imageapi.ImageStreamTag), err
}
示例10: Instantiate
func (c *FakeDeploymentConfigs) Instantiate(inObj *deployapi.DeploymentRequest) (*deployapi.DeploymentConfig, error) {
deployment := &deployapi.DeploymentConfig{ObjectMeta: kapi.ObjectMeta{Name: inObj.Name}}
obj, err := c.Fake.Invokes(ktestclient.NewUpdateAction("deploymentconfigs/instantiate", c.Namespace, deployment), deployment)
if obj == nil {
return nil, err
}
return obj.(*deployapi.DeploymentConfig), err
}
示例11: UpdateStatus
func (c *FakeRoutes) UpdateStatus(inObj *routeapi.Route) (*routeapi.Route, error) {
action := ktestclient.NewUpdateAction("routes", c.Namespace, inObj)
action.Subresource = "status"
obj, err := c.Fake.Invokes(action, inObj)
if obj == nil {
return nil, err
}
return obj.(*routeapi.Route), err
}
示例12: expectUpdateRCAction
func (f *fixture) expectUpdateRCAction(rc *api.ReplicationController) {
f.actions = append(f.actions, testclient.NewUpdateAction("replicationcontrollers", rc.Namespace, rc))
f.objects.Items = append(f.objects.Items, rc)
}
示例13: expectUpdateDeploymentAction
func (f *fixture) expectUpdateDeploymentAction(d *exp.Deployment) {
f.actions = append(f.actions, testclient.NewUpdateAction("deployments", d.Namespace, d))
f.objects.Items = append(f.objects.Items, d)
}
示例14: TestScale
func TestScale(t *testing.T) {
tests := []struct {
testName string
namespace string
name string
count uint
preconditions *kubectl.ScalePrecondition
retry, waitForReplicas *kubectl.RetryParams
oc *testclient.Fake
kc *ktestclient.Fake
expected []ktestclient.Action
kexpected []ktestclient.Action
expectedErr error
}{
{
testName: "simple scale",
namespace: "default",
name: "foo",
count: uint(3),
oc: testclient.NewSimpleFake(deploytest.OkDeploymentConfig(1)),
kc: ktestclient.NewSimpleFake(mkDeploymentList(1)),
expected: []ktestclient.Action{
ktestclient.NewGetAction("deploymentconfigs", "default", "foo"),
},
kexpected: []ktestclient.Action{
ktestclient.NewGetAction("replicationcontrollers", "default", "config-1"),
ktestclient.NewUpdateAction("replicationcontrollers", "default", nil),
},
expectedErr: nil,
},
{
testName: "wait for replicas",
namespace: "default",
name: "foo",
count: uint(3),
waitForReplicas: &kubectl.RetryParams{Interval: time.Millisecond, Timeout: time.Millisecond},
oc: testclient.NewSimpleFake(deploytest.OkDeploymentConfig(1)),
kc: ktestclient.NewSimpleFake(mkDeploymentList(1)),
expected: []ktestclient.Action{
ktestclient.NewGetAction("deploymentconfigs", "default", "foo"),
},
kexpected: []ktestclient.Action{
ktestclient.NewGetAction("replicationcontrollers", "default", "config-1"),
ktestclient.NewUpdateAction("replicationcontrollers", "default", nil),
ktestclient.NewGetAction("replicationcontrollers", "default", "config-1"),
ktestclient.NewGetAction("replicationcontrollers", "", "config-1"),
},
expectedErr: nil,
},
{
testName: "no deployment - dc scale",
namespace: "default",
name: "foo",
count: uint(3),
oc: testclient.NewSimpleFake(deploytest.OkDeploymentConfig(1)),
kc: ktestclient.NewSimpleFake(),
expected: []ktestclient.Action{
ktestclient.NewGetAction("deploymentconfigs", "default", "foo"),
ktestclient.NewGetAction("deploymentconfigs", "default", "foo"),
ktestclient.NewUpdateAction("deploymentconfigs", "default", nil),
},
kexpected: []ktestclient.Action{
ktestclient.NewGetAction("replicationcontrollers", "default", "config-1"),
},
expectedErr: nil,
},
}
for _, test := range tests {
scaler := NewDeploymentConfigScaler(test.oc, test.kc)
got := scaler.Scale(test.namespace, test.name, test.count, test.preconditions, test.retry, test.waitForReplicas)
if got != test.expectedErr {
t.Errorf("%s: error mismatch: expected %v, got %v", test.testName, test.expectedErr, got)
}
if len(test.oc.Actions()) != len(test.expected) {
t.Fatalf("%s: unexpected OpenShift actions amount: %d, expected %d", test.testName, len(test.oc.Actions()), len(test.expected))
}
for j, actualAction := range test.oc.Actions() {
e, a := test.expected[j], actualAction
if e.GetVerb() != a.GetVerb() ||
e.GetNamespace() != a.GetNamespace() ||
e.GetResource() != a.GetResource() ||
e.GetSubresource() != a.GetSubresource() {
t.Errorf("%s: unexpected OpenShift action[%d]: %s, expected %s", test.testName, j, a, e)
}
}
if len(test.kc.Actions()) != len(test.kexpected) {
t.Fatalf("%s: unexpected Kubernetes actions amount: %d, expected %d", test.testName, len(test.kc.Actions()), len(test.kexpected))
}
for j, actualAction := range test.kc.Actions() {
e, a := test.kexpected[j], actualAction
if e.GetVerb() != a.GetVerb() ||
e.GetNamespace() != a.GetNamespace() ||
e.GetResource() != a.GetResource() ||
e.GetSubresource() != a.GetSubresource() {
t.Errorf("%s: unexpected Kubernetes action[%d]: %s, expected %s", test.testName, j, a, e)
}
}
//.........这里部分代码省略.........
示例15: Update
func (c *fakeRc) Update(controller *api.ReplicationController) (*api.ReplicationController, error) {
c.Fake.Invokes(testclient.NewUpdateAction("replicationcontrollers", controller.Namespace, controller), nil)
return controller, nil
}