Merge pull request #83064 from liggitt/propagate-context

Propagate context to remote authorize/authenticate webhook calls

Kubernetes-commit: 327f53ba57aeaa4b7e7c20b1ef98c42b26b7ea7f
This commit is contained in:
Kubernetes Publisher 2019-09-25 09:32:01 -07:00
commit 0e97bf0202
20 changed files with 140 additions and 0 deletions

View File

@ -17,11 +17,17 @@ limitations under the License.
package fake package fake
import ( import (
"context"
authenticationapi "k8s.io/api/authentication/v1" authenticationapi "k8s.io/api/authentication/v1"
core "k8s.io/client-go/testing" core "k8s.io/client-go/testing"
) )
func (c *FakeTokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) { func (c *FakeTokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
return c.CreateContext(context.Background(), tokenReview)
}
func (c *FakeTokenReviews) CreateContext(ctx context.Context, tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authenticationapi.SchemeGroupVersion.WithResource("tokenreviews"), tokenReview), &authenticationapi.TokenReview{}) obj, err := c.Fake.Invokes(core.NewRootCreateAction(authenticationapi.SchemeGroupVersion.WithResource("tokenreviews"), tokenReview), &authenticationapi.TokenReview{})
return obj.(*authenticationapi.TokenReview), err return obj.(*authenticationapi.TokenReview), err
} }

View File

@ -17,16 +17,24 @@ limitations under the License.
package v1 package v1
import ( import (
"context"
authenticationapi "k8s.io/api/authentication/v1" authenticationapi "k8s.io/api/authentication/v1"
) )
type TokenReviewExpansion interface { type TokenReviewExpansion interface {
Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error)
CreateContext(ctx context.Context, tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error)
} }
func (c *tokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) { func (c *tokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
return c.CreateContext(context.Background(), tokenReview)
}
func (c *tokenReviews) CreateContext(ctx context.Context, tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
result = &authenticationapi.TokenReview{} result = &authenticationapi.TokenReview{}
err = c.client.Post(). err = c.client.Post().
Context(ctx).
Resource("tokenreviews"). Resource("tokenreviews").
Body(tokenReview). Body(tokenReview).
Do(). Do().

View File

@ -17,11 +17,17 @@ limitations under the License.
package fake package fake
import ( import (
"context"
authenticationapi "k8s.io/api/authentication/v1beta1" authenticationapi "k8s.io/api/authentication/v1beta1"
core "k8s.io/client-go/testing" core "k8s.io/client-go/testing"
) )
func (c *FakeTokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) { func (c *FakeTokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
return c.CreateContext(context.Background(), tokenReview)
}
func (c *FakeTokenReviews) CreateContext(ctx context.Context, tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authenticationapi.SchemeGroupVersion.WithResource("tokenreviews"), tokenReview), &authenticationapi.TokenReview{}) obj, err := c.Fake.Invokes(core.NewRootCreateAction(authenticationapi.SchemeGroupVersion.WithResource("tokenreviews"), tokenReview), &authenticationapi.TokenReview{})
return obj.(*authenticationapi.TokenReview), err return obj.(*authenticationapi.TokenReview), err
} }

View File

@ -17,16 +17,24 @@ limitations under the License.
package v1beta1 package v1beta1
import ( import (
"context"
authenticationapi "k8s.io/api/authentication/v1beta1" authenticationapi "k8s.io/api/authentication/v1beta1"
) )
type TokenReviewExpansion interface { type TokenReviewExpansion interface {
Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error)
CreateContext(ctx context.Context, tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error)
} }
func (c *tokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) { func (c *tokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
return c.CreateContext(context.Background(), tokenReview)
}
func (c *tokenReviews) CreateContext(ctx context.Context, tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
result = &authenticationapi.TokenReview{} result = &authenticationapi.TokenReview{}
err = c.client.Post(). err = c.client.Post().
Context(ctx).
Resource("tokenreviews"). Resource("tokenreviews").
Body(tokenReview). Body(tokenReview).
Do(). Do().

View File

@ -17,11 +17,17 @@ limitations under the License.
package fake package fake
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1" authorizationapi "k8s.io/api/authorization/v1"
core "k8s.io/client-go/testing" core "k8s.io/client-go/testing"
) )
func (c *FakeLocalSubjectAccessReviews) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) { func (c *FakeLocalSubjectAccessReviews) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
return c.CreateContext(context.Background(), sar)
}
func (c *FakeLocalSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
obj, err := c.Fake.Invokes(core.NewCreateAction(authorizationapi.SchemeGroupVersion.WithResource("localsubjectaccessreviews"), c.ns, sar), &authorizationapi.SubjectAccessReview{}) obj, err := c.Fake.Invokes(core.NewCreateAction(authorizationapi.SchemeGroupVersion.WithResource("localsubjectaccessreviews"), c.ns, sar), &authorizationapi.SubjectAccessReview{})
return obj.(*authorizationapi.LocalSubjectAccessReview), err return obj.(*authorizationapi.LocalSubjectAccessReview), err
} }

View File

@ -17,11 +17,17 @@ limitations under the License.
package fake package fake
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1" authorizationapi "k8s.io/api/authorization/v1"
core "k8s.io/client-go/testing" core "k8s.io/client-go/testing"
) )
func (c *FakeSelfSubjectAccessReviews) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) { func (c *FakeSelfSubjectAccessReviews) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
return c.CreateContext(context.Background(), sar)
}
func (c *FakeSelfSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectaccessreviews"), sar), &authorizationapi.SelfSubjectAccessReview{}) obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectaccessreviews"), sar), &authorizationapi.SelfSubjectAccessReview{})
return obj.(*authorizationapi.SelfSubjectAccessReview), err return obj.(*authorizationapi.SelfSubjectAccessReview), err
} }

View File

@ -17,11 +17,17 @@ limitations under the License.
package fake package fake
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1" authorizationapi "k8s.io/api/authorization/v1"
core "k8s.io/client-go/testing" core "k8s.io/client-go/testing"
) )
func (c *FakeSelfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) { func (c *FakeSelfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
return c.CreateContext(context.Background(), srr)
}
func (c *FakeSelfSubjectRulesReviews) CreateContext(ctx context.Context, srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectrulesreviews"), srr), &authorizationapi.SelfSubjectRulesReview{}) obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectrulesreviews"), srr), &authorizationapi.SelfSubjectRulesReview{})
return obj.(*authorizationapi.SelfSubjectRulesReview), err return obj.(*authorizationapi.SelfSubjectRulesReview), err
} }

View File

@ -17,11 +17,17 @@ limitations under the License.
package fake package fake
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1" authorizationapi "k8s.io/api/authorization/v1"
core "k8s.io/client-go/testing" core "k8s.io/client-go/testing"
) )
func (c *FakeSubjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) { func (c *FakeSubjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) {
return c.CreateContext(context.Background(), sar)
}
func (c *FakeSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) {
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("subjectaccessreviews"), sar), &authorizationapi.SubjectAccessReview{}) obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("subjectaccessreviews"), sar), &authorizationapi.SubjectAccessReview{})
if obj == nil { if obj == nil {
return nil, err return nil, err

View File

@ -17,16 +17,24 @@ limitations under the License.
package v1 package v1
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1" authorizationapi "k8s.io/api/authorization/v1"
) )
type LocalSubjectAccessReviewExpansion interface { type LocalSubjectAccessReviewExpansion interface {
Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error)
CreateContext(ctx context.Context, sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error)
} }
func (c *localSubjectAccessReviews) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) { func (c *localSubjectAccessReviews) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
return c.CreateContext(context.Background(), sar)
}
func (c *localSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
result = &authorizationapi.LocalSubjectAccessReview{} result = &authorizationapi.LocalSubjectAccessReview{}
err = c.client.Post(). err = c.client.Post().
Context(ctx).
Namespace(c.ns). Namespace(c.ns).
Resource("localsubjectaccessreviews"). Resource("localsubjectaccessreviews").
Body(sar). Body(sar).

View File

@ -17,16 +17,24 @@ limitations under the License.
package v1 package v1
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1" authorizationapi "k8s.io/api/authorization/v1"
) )
type SelfSubjectAccessReviewExpansion interface { type SelfSubjectAccessReviewExpansion interface {
Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error)
CreateContext(ctx context.Context, sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error)
} }
func (c *selfSubjectAccessReviews) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) { func (c *selfSubjectAccessReviews) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
return c.CreateContext(context.Background(), sar)
}
func (c *selfSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
result = &authorizationapi.SelfSubjectAccessReview{} result = &authorizationapi.SelfSubjectAccessReview{}
err = c.client.Post(). err = c.client.Post().
Context(ctx).
Resource("selfsubjectaccessreviews"). Resource("selfsubjectaccessreviews").
Body(sar). Body(sar).
Do(). Do().

View File

@ -17,16 +17,24 @@ limitations under the License.
package v1 package v1
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1" authorizationapi "k8s.io/api/authorization/v1"
) )
type SelfSubjectRulesReviewExpansion interface { type SelfSubjectRulesReviewExpansion interface {
Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error)
CreateContext(ctx context.Context, srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error)
} }
func (c *selfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) { func (c *selfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
return c.CreateContext(context.Background(), srr)
}
func (c *selfSubjectRulesReviews) CreateContext(ctx context.Context, srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
result = &authorizationapi.SelfSubjectRulesReview{} result = &authorizationapi.SelfSubjectRulesReview{}
err = c.client.Post(). err = c.client.Post().
Context(ctx).
Resource("selfsubjectrulesreviews"). Resource("selfsubjectrulesreviews").
Body(srr). Body(srr).
Do(). Do().

View File

@ -17,17 +17,25 @@ limitations under the License.
package v1 package v1
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1" authorizationapi "k8s.io/api/authorization/v1"
) )
// The SubjectAccessReviewExpansion interface allows manually adding extra methods to the AuthorizationInterface. // The SubjectAccessReviewExpansion interface allows manually adding extra methods to the AuthorizationInterface.
type SubjectAccessReviewExpansion interface { type SubjectAccessReviewExpansion interface {
Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error)
CreateContext(ctx context.Context, sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error)
} }
func (c *subjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) { func (c *subjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) {
return c.CreateContext(context.Background(), sar)
}
func (c *subjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) {
result = &authorizationapi.SubjectAccessReview{} result = &authorizationapi.SubjectAccessReview{}
err = c.client.Post(). err = c.client.Post().
Context(ctx).
Resource("subjectaccessreviews"). Resource("subjectaccessreviews").
Body(sar). Body(sar).
Do(). Do().

View File

@ -17,11 +17,17 @@ limitations under the License.
package fake package fake
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1beta1" authorizationapi "k8s.io/api/authorization/v1beta1"
core "k8s.io/client-go/testing" core "k8s.io/client-go/testing"
) )
func (c *FakeLocalSubjectAccessReviews) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) { func (c *FakeLocalSubjectAccessReviews) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
return c.CreateContext(context.Background(), sar)
}
func (c *FakeLocalSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
obj, err := c.Fake.Invokes(core.NewCreateAction(authorizationapi.SchemeGroupVersion.WithResource("localsubjectaccessreviews"), c.ns, sar), &authorizationapi.SubjectAccessReview{}) obj, err := c.Fake.Invokes(core.NewCreateAction(authorizationapi.SchemeGroupVersion.WithResource("localsubjectaccessreviews"), c.ns, sar), &authorizationapi.SubjectAccessReview{})
return obj.(*authorizationapi.LocalSubjectAccessReview), err return obj.(*authorizationapi.LocalSubjectAccessReview), err
} }

View File

@ -17,11 +17,17 @@ limitations under the License.
package fake package fake
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1beta1" authorizationapi "k8s.io/api/authorization/v1beta1"
core "k8s.io/client-go/testing" core "k8s.io/client-go/testing"
) )
func (c *FakeSelfSubjectAccessReviews) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) { func (c *FakeSelfSubjectAccessReviews) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
return c.CreateContext(context.Background(), sar)
}
func (c *FakeSelfSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectaccessreviews"), sar), &authorizationapi.SelfSubjectAccessReview{}) obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectaccessreviews"), sar), &authorizationapi.SelfSubjectAccessReview{})
return obj.(*authorizationapi.SelfSubjectAccessReview), err return obj.(*authorizationapi.SelfSubjectAccessReview), err
} }

View File

@ -17,11 +17,17 @@ limitations under the License.
package fake package fake
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1beta1" authorizationapi "k8s.io/api/authorization/v1beta1"
core "k8s.io/client-go/testing" core "k8s.io/client-go/testing"
) )
func (c *FakeSelfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) { func (c *FakeSelfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
return c.CreateContext(context.Background(), srr)
}
func (c *FakeSelfSubjectRulesReviews) CreateContext(ctx context.Context, srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectrulesreviews"), srr), &authorizationapi.SelfSubjectRulesReview{}) obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectrulesreviews"), srr), &authorizationapi.SelfSubjectRulesReview{})
return obj.(*authorizationapi.SelfSubjectRulesReview), err return obj.(*authorizationapi.SelfSubjectRulesReview), err
} }

View File

@ -17,11 +17,17 @@ limitations under the License.
package fake package fake
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1beta1" authorizationapi "k8s.io/api/authorization/v1beta1"
core "k8s.io/client-go/testing" core "k8s.io/client-go/testing"
) )
func (c *FakeSubjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) { func (c *FakeSubjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) {
return c.CreateContext(context.Background(), sar)
}
func (c *FakeSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) {
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("subjectaccessreviews"), sar), &authorizationapi.SubjectAccessReview{}) obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("subjectaccessreviews"), sar), &authorizationapi.SubjectAccessReview{})
return obj.(*authorizationapi.SubjectAccessReview), err return obj.(*authorizationapi.SubjectAccessReview), err
} }

View File

@ -17,16 +17,24 @@ limitations under the License.
package v1beta1 package v1beta1
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1beta1" authorizationapi "k8s.io/api/authorization/v1beta1"
) )
type LocalSubjectAccessReviewExpansion interface { type LocalSubjectAccessReviewExpansion interface {
Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error)
CreateContext(ctx context.Context, sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error)
} }
func (c *localSubjectAccessReviews) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) { func (c *localSubjectAccessReviews) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
return c.CreateContext(context.Background(), sar)
}
func (c *localSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
result = &authorizationapi.LocalSubjectAccessReview{} result = &authorizationapi.LocalSubjectAccessReview{}
err = c.client.Post(). err = c.client.Post().
Context(ctx).
Namespace(c.ns). Namespace(c.ns).
Resource("localsubjectaccessreviews"). Resource("localsubjectaccessreviews").
Body(sar). Body(sar).

View File

@ -17,16 +17,24 @@ limitations under the License.
package v1beta1 package v1beta1
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1beta1" authorizationapi "k8s.io/api/authorization/v1beta1"
) )
type SelfSubjectAccessReviewExpansion interface { type SelfSubjectAccessReviewExpansion interface {
Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error)
CreateContext(ctx context.Context, sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error)
} }
func (c *selfSubjectAccessReviews) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) { func (c *selfSubjectAccessReviews) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
return c.CreateContext(context.Background(), sar)
}
func (c *selfSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
result = &authorizationapi.SelfSubjectAccessReview{} result = &authorizationapi.SelfSubjectAccessReview{}
err = c.client.Post(). err = c.client.Post().
Context(ctx).
Resource("selfsubjectaccessreviews"). Resource("selfsubjectaccessreviews").
Body(sar). Body(sar).
Do(). Do().

View File

@ -17,16 +17,24 @@ limitations under the License.
package v1beta1 package v1beta1
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1beta1" authorizationapi "k8s.io/api/authorization/v1beta1"
) )
type SelfSubjectRulesReviewExpansion interface { type SelfSubjectRulesReviewExpansion interface {
Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error)
CreateContext(ctx context.Context, srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error)
} }
func (c *selfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) { func (c *selfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
return c.CreateContext(context.Background(), srr)
}
func (c *selfSubjectRulesReviews) CreateContext(ctx context.Context, srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
result = &authorizationapi.SelfSubjectRulesReview{} result = &authorizationapi.SelfSubjectRulesReview{}
err = c.client.Post(). err = c.client.Post().
Context(ctx).
Resource("selfsubjectrulesreviews"). Resource("selfsubjectrulesreviews").
Body(srr). Body(srr).
Do(). Do().

View File

@ -17,17 +17,25 @@ limitations under the License.
package v1beta1 package v1beta1
import ( import (
"context"
authorizationapi "k8s.io/api/authorization/v1beta1" authorizationapi "k8s.io/api/authorization/v1beta1"
) )
// The SubjectAccessReviewExpansion interface allows manually adding extra methods to the AuthorizationInterface. // The SubjectAccessReviewExpansion interface allows manually adding extra methods to the AuthorizationInterface.
type SubjectAccessReviewExpansion interface { type SubjectAccessReviewExpansion interface {
Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error)
CreateContext(ctx context.Context, sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error)
} }
func (c *subjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) { func (c *subjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) {
return c.CreateContext(context.Background(), sar)
}
func (c *subjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) {
result = &authorizationapi.SubjectAccessReview{} result = &authorizationapi.SubjectAccessReview{}
err = c.client.Post(). err = c.client.Post().
Context(ctx).
Resource("subjectaccessreviews"). Resource("subjectaccessreviews").
Body(sar). Body(sar).
Do(). Do().