本文整理汇总了Golang中k8s/io/kubernetes/pkg/client/unversioned/testclient.NewGetAction函数的典型用法代码示例。如果您正苦于以下问题:Golang NewGetAction函数的具体用法?Golang NewGetAction怎么用?Golang NewGetAction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewGetAction函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Secrets
func (c *FakeImageStreamSecrets) Secrets(name string, options kapi.ListOptions) (*kapi.SecretList, error) {
obj, err := c.Fake.Invokes(ktestclient.NewGetAction("imagestreams/secrets", c.Namespace, name), &kapi.SecretList{})
if obj == nil {
return nil, err
}
return obj.(*kapi.SecretList), err
}
示例2: Get
func (c *FakeAppliedClusterResourceQuotas) Get(name string) (*quotaapi.AppliedClusterResourceQuota, error) {
obj, err := c.Fake.Invokes(ktestclient.NewGetAction("appliedclusterresourcequotas", c.Namespace, name), "aapi.AppliedClusterResourceQuota{})
if obj == nil {
return nil, err
}
return obj.(*quotaapi.AppliedClusterResourceQuota), err
}
示例3: Get
func (c *FakeEgressNetworkPolicy) Get(name string) (*sdnapi.EgressNetworkPolicy, error) {
obj, err := c.Fake.Invokes(ktestclient.NewGetAction("egressnetworkpolicies", c.Namespace, name), &sdnapi.EgressNetworkPolicy{})
if obj == nil {
return nil, err
}
return obj.(*sdnapi.EgressNetworkPolicy), err
}
示例4: Get
func (c *FakeImageStreams) Get(name string) (*imageapi.ImageStream, error) {
obj, err := c.Fake.Invokes(ktestclient.NewGetAction("imagestreams", c.Namespace, name), &imageapi.ImageStream{})
if obj == nil {
return nil, err
}
return obj.(*imageapi.ImageStream), err
}
示例5: Get
func (c *FakeImageStreamTags) Get(name, tag string) (*imageapi.ImageStreamTag, error) {
obj, err := c.Fake.Invokes(ktestclient.NewGetAction("imagestreamtags", c.Namespace, imageapi.JoinImageStreamTag(name, tag)), &imageapi.ImageStreamTag{})
if obj == nil {
return nil, err
}
return obj.(*imageapi.ImageStreamTag), err
}
示例6: Get
func (c *FakeRoleBindings) Get(name string) (*authorizationapi.RoleBinding, error) {
obj, err := c.Fake.Invokes(ktestclient.NewGetAction("rolebindings", c.Namespace, name), &authorizationapi.RoleBinding{})
if obj == nil {
return nil, err
}
return obj.(*authorizationapi.RoleBinding), err
}
示例7: GetScale
func (c *FakeDeploymentConfigs) GetScale(name string) (*extensions.Scale, error) {
obj, err := c.Fake.Invokes(ktestclient.NewGetAction("deploymentconfigs/scale", c.Namespace, name), &extensions.Scale{})
if obj == nil {
return nil, err
}
return obj.(*extensions.Scale), err
}
示例8: Get
func (c *FakePolicies) Get(name string) (*authorizationapi.Policy, error) {
obj, err := c.Fake.Invokes(ktestclient.NewGetAction("policies", c.Namespace, name), &authorizationapi.Policy{})
if obj == nil {
return nil, err
}
return obj.(*authorizationapi.Policy), err
}
示例9: Get
func (c *FakeBuilds) Get(name string) (*buildapi.Build, error) {
obj, err := c.Fake.Invokes(ktestclient.NewGetAction("builds", c.Namespace, name), &buildapi.Build{})
if obj == nil {
return nil, err
}
return obj.(*buildapi.Build), err
}
示例10: Get
func (c *FakeDeploymentConfigs) Get(name string) (*deployapi.DeploymentConfig, error) {
obj, err := c.Fake.Invokes(ktestclient.NewGetAction("deploymentconfigs", c.Namespace, name), &deployapi.DeploymentConfig{})
if obj == nil {
return nil, err
}
return obj.(*deployapi.DeploymentConfig), err
}
示例11: Get
func (c *FakeBackingServiceInstances) Get(name string) (*backingserviceinstanceapi.BackingServiceInstance, error) {
obj, err := c.Fake.Invokes(ktestclient.NewGetAction("backingserviceinstances", c.Namespace, name), &backingserviceinstanceapi.BackingServiceInstance{})
if obj == nil {
return nil, err
}
return obj.(*backingserviceinstanceapi.BackingServiceInstance), err
}
示例12: Get
func (c *FakeRoutes) Get(name string) (*routeapi.Route, error) {
obj, err := c.Fake.Invokes(ktestclient.NewGetAction("routes", c.Namespace, name), &routeapi.Route{})
if obj == nil {
return nil, err
}
return obj.(*routeapi.Route), err
}
示例13: Get
func (c *fakeRc) Get(name string) (*api.ReplicationController, error) {
action := testclient.NewGetAction("replicationcontrollers", "", name)
if len(c.responses) == 0 {
return nil, fmt.Errorf("Unexpected Action: %s", action)
}
c.Fake.Invokes(action, nil)
result := c.responses[0]
c.responses = c.responses[1:]
return result.controller, result.err
}
示例14: Get
func (c *FakeImageStreamImages) Get(repo, imageID string) (*imageapi.ImageStreamImage, error) {
name := fmt.Sprintf("%[email protected]%s", repo, imageID)
obj, err := c.Fake.Invokes(ktestclient.NewGetAction("imagestreamimages", c.Namespace, name), &imageapi.ImageStreamImage{})
if obj == nil {
return nil, err
}
return obj.(*imageapi.ImageStreamImage), err
}
示例15: TestStop
func TestStop(t *testing.T) {
notfound := func() runtime.Object {
return &(kerrors.NewNotFound(kapi.Resource("DeploymentConfig"), "config").ErrStatus)
}
pause := func(d *deployapi.DeploymentConfig) *deployapi.DeploymentConfig {
d.Spec.Paused = true
return d
}
fakeDC := map[string]*deployapi.DeploymentConfig{
"simple-stop": deploytest.OkDeploymentConfig(1),
"legacy-simple-stop": deploytest.OkDeploymentConfig(1),
"multi-stop": deploytest.OkDeploymentConfig(5),
"legacy-multi-stop": deploytest.OkDeploymentConfig(5),
"no-deployments": deploytest.OkDeploymentConfig(5),
"legacy-no-deployments": deploytest.OkDeploymentConfig(5),
}
tests := []struct {
testName string
namespace string
name string
oc *testclient.Fake
kc *ktestclient.Fake
expected []ktestclient.Action
kexpected []ktestclient.Action
err bool
}{
{
testName: "simple stop",
namespace: "default",
name: "config",
oc: testclient.NewSimpleFake(fakeDC["simple-stop"]),
kc: ktestclient.NewSimpleFake(mkdeploymentlist(1)),
expected: []ktestclient.Action{
ktestclient.NewGetAction("deploymentconfigs", "default", "config"),
ktestclient.NewUpdateAction("deploymentconfigs", "default", pause(fakeDC["simple-stop"])),
ktestclient.NewGetAction("deploymentconfigs", "default", "config"),
ktestclient.NewDeleteAction("deploymentconfigs", "default", "config"),
},
kexpected: []ktestclient.Action{
ktestclient.NewListAction("replicationcontrollers", "default", kapi.ListOptions{}),
ktestclient.NewGetAction("replicationcontrollers", "", "config-1"),
ktestclient.NewListAction("replicationcontrollers", "", kapi.ListOptions{}),
ktestclient.NewGetAction("replicationcontrollers", "", "config-1"),
ktestclient.NewUpdateAction("replicationcontrollers", "", nil),
ktestclient.NewGetAction("replicationcontrollers", "", "config-1"),
ktestclient.NewGetAction("replicationcontrollers", "", "config-1"),
ktestclient.NewDeleteAction("replicationcontrollers", "", "config-1"),
},
err: false,
},
{
testName: "legacy simple stop",
namespace: "default",
name: "config",
oc: testclient.NewSimpleFake(fakeDC["legacy-simple-stop"]),
kc: ktestclient.NewSimpleFake(mkdeploymentlist(1)),
expected: []ktestclient.Action{
ktestclient.NewGetAction("deploymentconfigs", "default", "config"),
ktestclient.NewUpdateAction("deploymentconfigs", "default", nil),
ktestclient.NewGetAction("deploymentconfigs", "default", "config"),
ktestclient.NewDeleteAction("deploymentconfigs", "default", "config"),
},
kexpected: []ktestclient.Action{
ktestclient.NewListAction("replicationcontrollers", "default", kapi.ListOptions{}),
ktestclient.NewGetAction("replicationcontrollers", "", "config-1"),
ktestclient.NewListAction("replicationcontrollers", "", kapi.ListOptions{}),
ktestclient.NewGetAction("replicationcontrollers", "", "config-1"),
ktestclient.NewUpdateAction("replicationcontrollers", "", nil),
ktestclient.NewGetAction("replicationcontrollers", "", "config-1"),
ktestclient.NewGetAction("replicationcontrollers", "", "config-1"),
ktestclient.NewDeleteAction("replicationcontrollers", "", "config-1"),
},
err: false,
},
{
testName: "stop multiple controllers",
namespace: "default",
name: "config",
oc: testclient.NewSimpleFake(fakeDC["multi-stop"]),
kc: ktestclient.NewSimpleFake(mkdeploymentlist(1, 2, 3, 4, 5)),
expected: []ktestclient.Action{
ktestclient.NewGetAction("deploymentconfigs", "default", "config"),
ktestclient.NewUpdateAction("deploymentconfigs", "default", pause(fakeDC["multi-stop"])),
ktestclient.NewGetAction("deploymentconfigs", "default", "config"),
ktestclient.NewDeleteAction("deploymentconfigs", "default", "config"),
},
kexpected: []ktestclient.Action{
ktestclient.NewListAction("replicationcontrollers", "default", kapi.ListOptions{}),
ktestclient.NewGetAction("replicationcontrollers", "", "config-1"),
ktestclient.NewListAction("replicationcontrollers", "", kapi.ListOptions{}),
ktestclient.NewGetAction("replicationcontrollers", "", "config-1"),
ktestclient.NewUpdateAction("replicationcontrollers", "", nil),
ktestclient.NewGetAction("replicationcontrollers", "", "config-1"),
ktestclient.NewGetAction("replicationcontrollers", "", "config-4"),
ktestclient.NewDeleteAction("replicationcontrollers", "", "config-1"),
ktestclient.NewGetAction("replicationcontrollers", "", "config-2"),
ktestclient.NewListAction("replicationcontrollers", "", kapi.ListOptions{}),
//.........这里部分代码省略.........