Upgrade OpenShift and its dependencies.

OpenShift version 1.4.0-alpha.0
This commit is contained in:
Tomas Kral
2016-10-18 12:04:00 +02:00
parent 5e1a5cbb3b
commit 1f8a0e06c9
1786 changed files with 424709 additions and 33395 deletions
@@ -0,0 +1,46 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
quotaapi "github.com/openshift/origin/pkg/quota/api"
)
// AppliedClusterResourceQuotasNamespacer has methods to work with AppliedClusterResourceQuota resources in a namespace
type AppliedClusterResourceQuotasNamespacer interface {
AppliedClusterResourceQuotas(namespace string) AppliedClusterResourceQuotaInterface
}
// AppliedClusterResourceQuotaInterface exposes methods on AppliedClusterResourceQuota resources.
type AppliedClusterResourceQuotaInterface interface {
List(opts kapi.ListOptions) (*quotaapi.AppliedClusterResourceQuotaList, error)
Get(name string) (*quotaapi.AppliedClusterResourceQuota, error)
}
// appliedClusterResourceQuotas implements AppliedClusterResourceQuotasNamespacer interface
type appliedClusterResourceQuotas struct {
r *Client
ns string
}
// newAppliedClusterResourceQuotas returns a appliedClusterResourceQuotas
func newAppliedClusterResourceQuotas(c *Client, namespace string) *appliedClusterResourceQuotas {
return &appliedClusterResourceQuotas{
r: c,
ns: namespace,
}
}
// List returns a list of appliedClusterResourceQuotas that match the label and field selectors.
func (c *appliedClusterResourceQuotas) List(opts kapi.ListOptions) (result *quotaapi.AppliedClusterResourceQuotaList, err error) {
result = &quotaapi.AppliedClusterResourceQuotaList{}
err = c.r.Get().Namespace(c.ns).Resource("appliedclusterresourcequotas").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular appliedClusterResourceQuota and error if one occurs.
func (c *appliedClusterResourceQuotas) Get(name string) (result *quotaapi.AppliedClusterResourceQuota, err error) {
result = &quotaapi.AppliedClusterResourceQuota{}
err = c.r.Get().Namespace(c.ns).Resource("appliedclusterresourcequotas").Name(name).Do().Into(result)
return
}
+132
View File
@@ -0,0 +1,132 @@
package client
import (
"fmt"
"io"
"net/url"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
buildapi "github.com/openshift/origin/pkg/build/api"
)
// ErrTriggerIsNotAWebHook is returned when a webhook URL is requested for a trigger
// that is not a webhook type.
var ErrTriggerIsNotAWebHook = fmt.Errorf("the specified trigger is not a webhook")
// BuildConfigsNamespacer has methods to work with BuildConfig resources in a namespace
type BuildConfigsNamespacer interface {
BuildConfigs(namespace string) BuildConfigInterface
}
// BuildConfigInterface exposes methods on BuildConfig resources
type BuildConfigInterface interface {
List(opts kapi.ListOptions) (*buildapi.BuildConfigList, error)
Get(name string) (*buildapi.BuildConfig, error)
Create(config *buildapi.BuildConfig) (*buildapi.BuildConfig, error)
Update(config *buildapi.BuildConfig) (*buildapi.BuildConfig, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
Instantiate(request *buildapi.BuildRequest) (result *buildapi.Build, err error)
InstantiateBinary(request *buildapi.BinaryBuildRequestOptions, r io.Reader) (result *buildapi.Build, err error)
WebHookURL(name string, trigger *buildapi.BuildTriggerPolicy) (*url.URL, error)
}
// buildConfigs implements BuildConfigsNamespacer interface
type buildConfigs struct {
r *Client
ns string
}
// newBuildConfigs returns a buildConfigs
func newBuildConfigs(c *Client, namespace string) *buildConfigs {
return &buildConfigs{
r: c,
ns: namespace,
}
}
// List returns a list of buildconfigs that match the label and field selectors.
func (c *buildConfigs) List(opts kapi.ListOptions) (result *buildapi.BuildConfigList, err error) {
result = &buildapi.BuildConfigList{}
err = c.r.Get().
Namespace(c.ns).
Resource("buildConfigs").
VersionedParams(&opts, kapi.ParameterCodec).
Do().
Into(result)
return
}
// Get returns information about a particular buildconfig and error if one occurs.
func (c *buildConfigs) Get(name string) (result *buildapi.BuildConfig, err error) {
result = &buildapi.BuildConfig{}
err = c.r.Get().Namespace(c.ns).Resource("buildConfigs").Name(name).Do().Into(result)
return
}
// WebHookURL returns the URL for the provided build config name and trigger policy, or ErrTriggerIsNotAWebHook
// if the trigger is not a webhook type.
func (c *buildConfigs) WebHookURL(name string, trigger *buildapi.BuildTriggerPolicy) (*url.URL, error) {
switch {
case trigger.GenericWebHook != nil:
return c.r.Get().Namespace(c.ns).Resource("buildConfigs").Name(name).SubResource("webhooks").Suffix(trigger.GenericWebHook.Secret, "generic").URL(), nil
case trigger.GitHubWebHook != nil:
return c.r.Get().Namespace(c.ns).Resource("buildConfigs").Name(name).SubResource("webhooks").Suffix(trigger.GitHubWebHook.Secret, "github").URL(), nil
default:
return nil, ErrTriggerIsNotAWebHook
}
}
// Create creates a new buildconfig. Returns the server's representation of the buildconfig and error if one occurs.
func (c *buildConfigs) Create(build *buildapi.BuildConfig) (result *buildapi.BuildConfig, err error) {
result = &buildapi.BuildConfig{}
err = c.r.Post().Namespace(c.ns).Resource("buildConfigs").Body(build).Do().Into(result)
return
}
// Update updates the buildconfig on server. Returns the server's representation of the buildconfig and error if one occurs.
func (c *buildConfigs) Update(build *buildapi.BuildConfig) (result *buildapi.BuildConfig, err error) {
result = &buildapi.BuildConfig{}
err = c.r.Put().Namespace(c.ns).Resource("buildConfigs").Name(build.Name).Body(build).Do().Into(result)
return
}
// Delete deletes a BuildConfig, returns error if one occurs.
func (c *buildConfigs) Delete(name string) error {
return c.r.Delete().Namespace(c.ns).Resource("buildConfigs").Name(name).Do().Error()
}
// Watch returns a watch.Interface that watches the requested buildConfigs.
func (c *buildConfigs) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("buildConfigs").
VersionedParams(&opts, kapi.ParameterCodec).
Watch()
}
// Instantiate instantiates a new build from build config returning new object or an error
func (c *buildConfigs) Instantiate(request *buildapi.BuildRequest) (result *buildapi.Build, err error) {
result = &buildapi.Build{}
err = c.r.Post().Namespace(c.ns).Resource("buildConfigs").Name(request.Name).SubResource("instantiate").Body(request).Do().Into(result)
return
}
// InstantiateBinary instantiates a new build from a build config, given a structured request and an input stream,
// and returns the created build or an error.
func (c *buildConfigs) InstantiateBinary(request *buildapi.BinaryBuildRequestOptions, r io.Reader) (result *buildapi.Build, err error) {
result = &buildapi.Build{}
err = c.r.Post().
Namespace(c.ns).
Resource("buildConfigs").
Name(request.Name).
SubResource("instantiatebinary").
VersionedParams(request, kapi.ParameterCodec).
Body(r).Do().Into(result)
return
}
+37
View File
@@ -0,0 +1,37 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/restclient"
api "github.com/openshift/origin/pkg/build/api"
)
// BuildLogsNamespacer has methods to work with BuildLogs resources in a namespace
type BuildLogsNamespacer interface {
BuildLogs(namespace string) BuildLogsInterface
}
// BuildLogsInterface exposes methods on BuildLogs resources.
type BuildLogsInterface interface {
Get(name string, opts api.BuildLogOptions) *restclient.Request
}
// buildLogs implements BuildLogsNamespacer interface
type buildLogs struct {
r *Client
ns string
}
// newBuildLogs returns a buildLogs
func newBuildLogs(c *Client, namespace string) *buildLogs {
return &buildLogs{
r: c,
ns: namespace,
}
}
// Get builds and returns a buildLog request
func (c *buildLogs) Get(name string, opts api.BuildLogOptions) *restclient.Request {
return c.r.Get().Namespace(c.ns).Resource("builds").Name(name).SubResource("log").VersionedParams(&opts, kapi.ParameterCodec)
}
+104
View File
@@ -0,0 +1,104 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
buildapi "github.com/openshift/origin/pkg/build/api"
)
// BuildsNamespacer has methods to work with Build resources in a namespace
type BuildsNamespacer interface {
Builds(namespace string) BuildInterface
}
// BuildInterface exposes methods on Build resources.
type BuildInterface interface {
List(opts kapi.ListOptions) (*buildapi.BuildList, error)
Get(name string) (*buildapi.Build, error)
Create(build *buildapi.Build) (*buildapi.Build, error)
Update(build *buildapi.Build) (*buildapi.Build, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
Clone(request *buildapi.BuildRequest) (*buildapi.Build, error)
UpdateDetails(build *buildapi.Build) (*buildapi.Build, error)
}
// builds implements BuildsNamespacer interface
type builds struct {
r *Client
ns string
}
// newBuilds returns a builds
func newBuilds(c *Client, namespace string) *builds {
return &builds{
r: c,
ns: namespace,
}
}
// List returns a list of builds that match the label and field selectors.
func (c *builds) List(opts kapi.ListOptions) (result *buildapi.BuildList, err error) {
result = &buildapi.BuildList{}
err = c.r.Get().
Namespace(c.ns).
Resource("builds").
VersionedParams(&opts, kapi.ParameterCodec).
Do().
Into(result)
return
}
// Get returns information about a particular build and error if one occurs.
func (c *builds) Get(name string) (result *buildapi.Build, err error) {
result = &buildapi.Build{}
err = c.r.Get().Namespace(c.ns).Resource("builds").Name(name).Do().Into(result)
return
}
// Create creates new build. Returns the server's representation of the build and error if one occurs.
func (c *builds) Create(build *buildapi.Build) (result *buildapi.Build, err error) {
result = &buildapi.Build{}
err = c.r.Post().Namespace(c.ns).Resource("builds").Body(build).Do().Into(result)
return
}
// Update updates the build on server. Returns the server's representation of the build and error if one occurs.
func (c *builds) Update(build *buildapi.Build) (result *buildapi.Build, err error) {
result = &buildapi.Build{}
err = c.r.Put().Namespace(c.ns).Resource("builds").Name(build.Name).Body(build).Do().Into(result)
return
}
// Delete deletes a build, returns error if one occurs.
func (c *builds) Delete(name string) (err error) {
err = c.r.Delete().Namespace(c.ns).Resource("builds").Name(name).Do().Error()
return
}
// Watch returns a watch.Interface that watches the requested builds
func (c *builds) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("builds").
VersionedParams(&opts, kapi.ParameterCodec).
Watch()
}
// Clone creates a clone of a build returning new object or an error
func (c *builds) Clone(request *buildapi.BuildRequest) (result *buildapi.Build, err error) {
result = &buildapi.Build{}
err = c.r.Post().Namespace(c.ns).Resource("builds").Name(request.Name).SubResource("clone").Body(request).Do().Into(result)
return
}
// UpdateDetails updates the build details for a given build.
// Currently only the Spec.Revision is allowed to be updated.
// Returns the server's representation of the build and error if one occurs.
func (c *builds) UpdateDetails(build *buildapi.Build) (result *buildapi.Build, err error) {
result = &buildapi.Build{}
err = c.r.Put().Namespace(c.ns).Resource("builds").Name(build.Name).SubResource("details").Body(build).Do().Into(result)
return
}
+367
View File
@@ -0,0 +1,367 @@
package client
import (
"fmt"
"os"
"path"
"runtime"
"strings"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/client/typed/discovery"
"github.com/openshift/origin/pkg/api/latest"
"github.com/openshift/origin/pkg/version"
)
// Interface exposes methods on OpenShift resources.
type Interface interface {
BuildsNamespacer
BuildConfigsNamespacer
BuildLogsNamespacer
ImagesInterfacer
ImageSignaturesInterfacer
ImageStreamsNamespacer
ImageStreamMappingsNamespacer
ImageStreamTagsNamespacer
ImageStreamImagesNamespacer
ImageStreamSecretsNamespacer
DeploymentConfigsNamespacer
DeploymentLogsNamespacer
RoutesNamespacer
HostSubnetsInterface
NetNamespacesInterface
ClusterNetworkingInterface
EgressNetworkPoliciesNamespacer
IdentitiesInterface
UsersInterface
GroupsInterface
UserIdentityMappingsInterface
ProjectsInterface
ProjectRequestsInterface
LocalSubjectAccessReviewsImpersonator
SubjectAccessReviewsImpersonator
LocalResourceAccessReviewsNamespacer
ResourceAccessReviews
SubjectAccessReviews
LocalSubjectAccessReviewsNamespacer
SelfSubjectRulesReviewsNamespacer
TemplatesNamespacer
TemplateConfigsNamespacer
OAuthClientsInterface
OAuthClientAuthorizationsInterface
OAuthAccessTokensInterface
OAuthAuthorizeTokensInterface
PoliciesNamespacer
PolicyBindingsNamespacer
RolesNamespacer
RoleBindingsNamespacer
ClusterPoliciesInterface
ClusterPolicyBindingsInterface
ClusterRolesInterface
ClusterRoleBindingsInterface
ClusterResourceQuotasInterface
AppliedClusterResourceQuotasNamespacer
}
// Builds provides a REST client for Builds
func (c *Client) Builds(namespace string) BuildInterface {
return newBuilds(c, namespace)
}
// BuildConfigs provides a REST client for BuildConfigs
func (c *Client) BuildConfigs(namespace string) BuildConfigInterface {
return newBuildConfigs(c, namespace)
}
// BuildLogs provides a REST client for BuildLogs
func (c *Client) BuildLogs(namespace string) BuildLogsInterface {
return newBuildLogs(c, namespace)
}
// Images provides a REST client for Images
func (c *Client) Images() ImageInterface {
return newImages(c)
}
// ImageSignatures provides a REST client for ImageSignatures
func (c *Client) ImageSignatures() ImageSignatureInterface {
return newImageSignatures(c)
}
// ImageStreamImages provides a REST client for retrieving image secrets in a namespace
func (c *Client) ImageStreamSecrets(namespace string) ImageStreamSecretInterface {
return newImageStreamSecrets(c, namespace)
}
// ImageStreams provides a REST client for ImageStream
func (c *Client) ImageStreams(namespace string) ImageStreamInterface {
return newImageStreams(c, namespace)
}
// ImageStreamMappings provides a REST client for ImageStreamMapping
func (c *Client) ImageStreamMappings(namespace string) ImageStreamMappingInterface {
return newImageStreamMappings(c, namespace)
}
// ImageStreamTags provides a REST client for ImageStreamTag
func (c *Client) ImageStreamTags(namespace string) ImageStreamTagInterface {
return newImageStreamTags(c, namespace)
}
// ImageStreamImages provides a REST client for ImageStreamImage
func (c *Client) ImageStreamImages(namespace string) ImageStreamImageInterface {
return newImageStreamImages(c, namespace)
}
// DeploymentConfigs provides a REST client for DeploymentConfig
func (c *Client) DeploymentConfigs(namespace string) DeploymentConfigInterface {
return newDeploymentConfigs(c, namespace)
}
// DeploymentLogs provides a REST client for DeploymentLog
func (c *Client) DeploymentLogs(namespace string) DeploymentLogInterface {
return newDeploymentLogs(c, namespace)
}
// Routes provides a REST client for Route
func (c *Client) Routes(namespace string) RouteInterface {
return newRoutes(c, namespace)
}
// HostSubnets provides a REST client for HostSubnet
func (c *Client) HostSubnets() HostSubnetInterface {
return newHostSubnet(c)
}
// NetNamespaces provides a REST client for NetNamespace
func (c *Client) NetNamespaces() NetNamespaceInterface {
return newNetNamespace(c)
}
// ClusterNetwork provides a REST client for ClusterNetworking
func (c *Client) ClusterNetwork() ClusterNetworkInterface {
return newClusterNetwork(c)
}
// EgressNetworkPolicies provides a REST client for EgressNetworkPolicy
func (c *Client) EgressNetworkPolicies(namespace string) EgressNetworkPolicyInterface {
return newEgressNetworkPolicy(c, namespace)
}
// Users provides a REST client for User
func (c *Client) Users() UserInterface {
return newUsers(c)
}
// Identities provides a REST client for Identity
func (c *Client) Identities() IdentityInterface {
return newIdentities(c)
}
// UserIdentityMappings provides a REST client for UserIdentityMapping
func (c *Client) UserIdentityMappings() UserIdentityMappingInterface {
return newUserIdentityMappings(c)
}
// Groups provides a REST client for Groups
func (c *Client) Groups() GroupInterface {
return newGroups(c)
}
// Projects provides a REST client for Projects
func (c *Client) Projects() ProjectInterface {
return newProjects(c)
}
// ProjectRequests provides a REST client for Projects
func (c *Client) ProjectRequests() ProjectRequestInterface {
return newProjectRequests(c)
}
// TemplateConfigs provides a REST client for TemplateConfig
func (c *Client) TemplateConfigs(namespace string) TemplateConfigInterface {
return newTemplateConfigs(c, namespace)
}
// Templates provides a REST client for Templates
func (c *Client) Templates(namespace string) TemplateInterface {
return newTemplates(c, namespace)
}
// Policies provides a REST client for Policies
func (c *Client) Policies(namespace string) PolicyInterface {
return newPolicies(c, namespace)
}
// PolicyBindings provides a REST client for PolicyBindings
func (c *Client) PolicyBindings(namespace string) PolicyBindingInterface {
return newPolicyBindings(c, namespace)
}
// Roles provides a REST client for Roles
func (c *Client) Roles(namespace string) RoleInterface {
return newRoles(c, namespace)
}
// RoleBindings provides a REST client for RoleBindings
func (c *Client) RoleBindings(namespace string) RoleBindingInterface {
return newRoleBindings(c, namespace)
}
// LocalResourceAccessReviews provides a REST client for LocalResourceAccessReviews
func (c *Client) LocalResourceAccessReviews(namespace string) LocalResourceAccessReviewInterface {
return newLocalResourceAccessReviews(c, namespace)
}
// ClusterResourceAccessReviews provides a REST client for ClusterResourceAccessReviews
func (c *Client) ResourceAccessReviews() ResourceAccessReviewInterface {
return newResourceAccessReviews(c)
}
// ImpersonateSubjectAccessReviews provides a REST client for SubjectAccessReviews
func (c *Client) ImpersonateSubjectAccessReviews(token string) SubjectAccessReviewInterface {
return newImpersonatingSubjectAccessReviews(c, token)
}
// ImpersonateLocalSubjectAccessReviews provides a REST client for SubjectAccessReviews
func (c *Client) ImpersonateLocalSubjectAccessReviews(namespace, token string) LocalSubjectAccessReviewInterface {
return newImpersonatingLocalSubjectAccessReviews(c, namespace, token)
}
// LocalSubjectAccessReviews provides a REST client for LocalSubjectAccessReviews
func (c *Client) LocalSubjectAccessReviews(namespace string) LocalSubjectAccessReviewInterface {
return newLocalSubjectAccessReviews(c, namespace)
}
// SubjectAccessReviews provides a REST client for SubjectAccessReviews
func (c *Client) SubjectAccessReviews() SubjectAccessReviewInterface {
return newSubjectAccessReviews(c)
}
func (c *Client) SelfSubjectRulesReviews(namespace string) SelfSubjectRulesReviewInterface {
return newSelfSubjectRulesReviews(c, namespace)
}
func (c *Client) OAuthClients() OAuthClientInterface {
return newOAuthClients(c)
}
func (c *Client) OAuthClientAuthorizations() OAuthClientAuthorizationInterface {
return newOAuthClientAuthorizations(c)
}
func (c *Client) OAuthAccessTokens() OAuthAccessTokenInterface {
return newOAuthAccessTokens(c)
}
func (c *Client) OAuthAuthorizeTokens() OAuthAuthorizeTokenInterface {
return newOAuthAuthorizeTokens(c)
}
func (c *Client) ClusterPolicies() ClusterPolicyInterface {
return newClusterPolicies(c)
}
func (c *Client) ClusterPolicyBindings() ClusterPolicyBindingInterface {
return newClusterPolicyBindings(c)
}
func (c *Client) ClusterRoles() ClusterRoleInterface {
return newClusterRoles(c)
}
func (c *Client) ClusterRoleBindings() ClusterRoleBindingInterface {
return newClusterRoleBindings(c)
}
func (c *Client) ClusterResourceQuotas() ClusterResourceQuotaInterface {
return newClusterResourceQuotas(c)
}
func (c *Client) AppliedClusterResourceQuotas(namespace string) AppliedClusterResourceQuotaInterface {
return newAppliedClusterResourceQuotas(c, namespace)
}
// Client is an OpenShift client object
type Client struct {
*restclient.RESTClient
}
// New creates an OpenShift client for the given config. This client works with builds, deployments,
// templates, routes, and images. It allows operations such as list, get, update and delete on these
// objects. An error is returned if the provided configuration is not valid.
func New(c *restclient.Config) (*Client, error) {
config := *c
if err := SetOpenShiftDefaults(&config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &Client{client}, nil
}
// DiscoveryClient returns a discovery client.
func (c *Client) Discovery() discovery.DiscoveryInterface {
d := NewDiscoveryClient(c.RESTClient)
return d
}
// SetOpenShiftDefaults sets the default settings on the passed
// client configuration
func SetOpenShiftDefaults(config *restclient.Config) error {
if len(config.UserAgent) == 0 {
config.UserAgent = DefaultOpenShiftUserAgent()
}
if config.GroupVersion == nil {
// Clients default to the preferred code API version
groupVersionCopy := latest.Version
config.GroupVersion = &groupVersionCopy
}
if config.APIPath == "" {
config.APIPath = "/oapi"
}
if config.NegotiatedSerializer == nil {
config.NegotiatedSerializer = kapi.Codecs
}
return nil
}
// NewOrDie creates an OpenShift client and panics if the provided API version is not recognized.
func NewOrDie(c *restclient.Config) *Client {
client, err := New(c)
if err != nil {
panic(err)
}
return client
}
// DefaultOpenShiftUserAgent returns the default user agent that clients can use.
func DefaultOpenShiftUserAgent() string {
commit := version.Get().GitCommit
if len(commit) > 7 {
commit = commit[:7]
}
if len(commit) == 0 {
commit = "unknown"
}
version := version.Get().GitVersion
seg := strings.SplitN(version, "-", 2)
version = seg[0]
return fmt.Sprintf("%s/%s (%s/%s) openshift/%s", path.Base(os.Args[0]), version, runtime.GOOS, runtime.GOARCH, commit)
}
// IsStatusErrorKind returns true if this error describes the provided kind.
func IsStatusErrorKind(err error, kind string) bool {
if s, ok := err.(errors.APIStatus); ok {
if details := s.Status().Details; details != nil {
return kind == details.Kind
}
}
return false
}
+73
View File
@@ -0,0 +1,73 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
quotaapi "github.com/openshift/origin/pkg/quota/api"
)
type ClusterResourceQuotasInterface interface {
ClusterResourceQuotas() ClusterResourceQuotaInterface
}
type ClusterResourceQuotaInterface interface {
List(opts kapi.ListOptions) (*quotaapi.ClusterResourceQuotaList, error)
Get(name string) (*quotaapi.ClusterResourceQuota, error)
Create(resourceQuota *quotaapi.ClusterResourceQuota) (*quotaapi.ClusterResourceQuota, error)
Update(resourceQuota *quotaapi.ClusterResourceQuota) (*quotaapi.ClusterResourceQuota, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
UpdateStatus(resourceQuota *quotaapi.ClusterResourceQuota) (*quotaapi.ClusterResourceQuota, error)
}
type clusterResourceQuotas struct {
r *Client
}
// newClusterResourceQuotas returns a clusterResourceQuotas
func newClusterResourceQuotas(c *Client) *clusterResourceQuotas {
return &clusterResourceQuotas{
r: c,
}
}
func (c *clusterResourceQuotas) List(opts kapi.ListOptions) (result *quotaapi.ClusterResourceQuotaList, err error) {
result = &quotaapi.ClusterResourceQuotaList{}
err = c.r.Get().Resource("clusterresourcequotas").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
func (c *clusterResourceQuotas) Get(name string) (result *quotaapi.ClusterResourceQuota, err error) {
result = &quotaapi.ClusterResourceQuota{}
err = c.r.Get().Resource("clusterresourcequotas").Name(name).Do().Into(result)
return
}
func (c *clusterResourceQuotas) Create(resourceQuota *quotaapi.ClusterResourceQuota) (result *quotaapi.ClusterResourceQuota, err error) {
result = &quotaapi.ClusterResourceQuota{}
err = c.r.Post().Resource("clusterresourcequotas").Body(resourceQuota).Do().Into(result)
return
}
func (c *clusterResourceQuotas) Update(resourceQuota *quotaapi.ClusterResourceQuota) (result *quotaapi.ClusterResourceQuota, err error) {
result = &quotaapi.ClusterResourceQuota{}
err = c.r.Put().Resource("clusterresourcequotas").Name(resourceQuota.Name).Body(resourceQuota).Do().Into(result)
return
}
func (c *clusterResourceQuotas) Delete(name string) (err error) {
err = c.r.Delete().Resource("clusterresourcequotas").Name(name).Do().Error()
return
}
func (c *clusterResourceQuotas) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().Prefix("watch").Resource("clusterresourcequotas").VersionedParams(&opts, kapi.ParameterCodec).Watch()
}
func (c *clusterResourceQuotas) UpdateStatus(resourceQuota *quotaapi.ClusterResourceQuota) (result *quotaapi.ClusterResourceQuota, err error) {
result = &quotaapi.ClusterResourceQuota{}
err = c.r.Put().Resource("clusterresourcequotas").Name(resourceQuota.Name).SubResource("status").Body(resourceQuota).Do().Into(result)
return
}
+50
View File
@@ -0,0 +1,50 @@
package client
import (
sdnapi "github.com/openshift/origin/pkg/sdn/api"
)
// ClusterNetworkingInterface has methods to work with ClusterNetwork resources
type ClusterNetworkingInterface interface {
ClusterNetwork() ClusterNetworkInterface
}
// ClusterNetworkInterface exposes methods on clusterNetwork resources.
type ClusterNetworkInterface interface {
Get(name string) (*sdnapi.ClusterNetwork, error)
Create(sub *sdnapi.ClusterNetwork) (*sdnapi.ClusterNetwork, error)
Update(sub *sdnapi.ClusterNetwork) (*sdnapi.ClusterNetwork, error)
}
// clusterNetwork implements ClusterNetworkInterface interface
type clusterNetwork struct {
r *Client
}
// newClusterNetwork returns a clusterNetwork
func newClusterNetwork(c *Client) *clusterNetwork {
return &clusterNetwork{
r: c,
}
}
// Get returns information about a particular network
func (c *clusterNetwork) Get(networkName string) (result *sdnapi.ClusterNetwork, err error) {
result = &sdnapi.ClusterNetwork{}
err = c.r.Get().Resource("clusterNetworks").Name(networkName).Do().Into(result)
return
}
// Create creates a new ClusterNetwork. Returns the server's representation of ClusterNetwork and error if one occurs.
func (c *clusterNetwork) Create(cn *sdnapi.ClusterNetwork) (result *sdnapi.ClusterNetwork, err error) {
result = &sdnapi.ClusterNetwork{}
err = c.r.Post().Resource("clusterNetworks").Body(cn).Do().Into(result)
return
}
// Update updates the ClusterNetwork on the server. Returns the server's representation of the ClusterNetwork and error if one occurs.
func (c *clusterNetwork) Update(cn *sdnapi.ClusterNetwork) (result *sdnapi.ClusterNetwork, err error) {
result = &sdnapi.ClusterNetwork{}
err = c.r.Put().Resource("clusterNetworks").Name(cn.Name).Body(cn).Do().Into(result)
return
}
+68
View File
@@ -0,0 +1,68 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
// ClusterPoliciesInterface has methods to work with ClusterPolicies resources in a namespace
type ClusterPoliciesInterface interface {
ClusterPolicies() ClusterPolicyInterface
}
// ClusterPolicyInterface exposes methods on ClusterPolicies resources
type ClusterPolicyInterface interface {
List(opts kapi.ListOptions) (*authorizationapi.ClusterPolicyList, error)
Get(name string) (*authorizationapi.ClusterPolicy, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
type ClusterPoliciesListerInterface interface {
ClusterPolicies() ClusterPolicyLister
}
type ClusterPolicyLister interface {
List(options kapi.ListOptions) (*authorizationapi.ClusterPolicyList, error)
Get(name string) (*authorizationapi.ClusterPolicy, error)
}
type SyncedClusterPoliciesListerInterface interface {
ClusterPoliciesListerInterface
LastSyncResourceVersion() string
}
type clusterPolicies struct {
r *Client
}
func newClusterPolicies(c *Client) *clusterPolicies {
return &clusterPolicies{
r: c,
}
}
// List returns a list of policies that match the label and field selectors.
func (c *clusterPolicies) List(opts kapi.ListOptions) (result *authorizationapi.ClusterPolicyList, err error) {
result = &authorizationapi.ClusterPolicyList{}
err = c.r.Get().Resource("clusterPolicies").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular policy and error if one occurs.
func (c *clusterPolicies) Get(name string) (result *authorizationapi.ClusterPolicy, err error) {
result = &authorizationapi.ClusterPolicy{}
err = c.r.Get().Resource("clusterPolicies").Name(name).Do().Into(result)
return
}
// Delete deletes a policy, returns error if one occurs.
func (c *clusterPolicies) Delete(name string) (err error) {
err = c.r.Delete().Resource("clusterPolicies").Name(name).Do().Error()
return
}
// Watch returns a watch.Interface that watches the requested clusterPolicies
func (c *clusterPolicies) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().Prefix("watch").Resource("clusterPolicies").VersionedParams(&opts, kapi.ParameterCodec).Watch()
}
+77
View File
@@ -0,0 +1,77 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
// ClusterPolicyBindingsInterface has methods to work with ClusterPolicyBindings resources in a namespace
type ClusterPolicyBindingsInterface interface {
ClusterPolicyBindings() ClusterPolicyBindingInterface
}
// ClusterPolicyBindingInterface exposes methods on ClusterPolicyBindings resources
type ClusterPolicyBindingInterface interface {
List(opts kapi.ListOptions) (*authorizationapi.ClusterPolicyBindingList, error)
Get(name string) (*authorizationapi.ClusterPolicyBinding, error)
Create(policyBinding *authorizationapi.ClusterPolicyBinding) (*authorizationapi.ClusterPolicyBinding, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
type ClusterPolicyBindingsListerInterface interface {
ClusterPolicyBindings() ClusterPolicyBindingLister
}
type ClusterPolicyBindingLister interface {
List(options kapi.ListOptions) (*authorizationapi.ClusterPolicyBindingList, error)
Get(name string) (*authorizationapi.ClusterPolicyBinding, error)
}
type SyncedClusterPolicyBindingsListerInterface interface {
ClusterPolicyBindingsListerInterface
LastSyncResourceVersion() string
}
type clusterPolicyBindings struct {
r *Client
}
// newClusterPolicyBindings returns a clusterPolicyBindings
func newClusterPolicyBindings(c *Client) *clusterPolicyBindings {
return &clusterPolicyBindings{
r: c,
}
}
// List returns a list of clusterPolicyBindings that match the label and field selectors.
func (c *clusterPolicyBindings) List(opts kapi.ListOptions) (result *authorizationapi.ClusterPolicyBindingList, err error) {
result = &authorizationapi.ClusterPolicyBindingList{}
err = c.r.Get().Resource("clusterPolicyBindings").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular clusterPolicyBindings and error if one occurs.
func (c *clusterPolicyBindings) Get(name string) (result *authorizationapi.ClusterPolicyBinding, err error) {
result = &authorizationapi.ClusterPolicyBinding{}
err = c.r.Get().Resource("clusterPolicyBindings").Name(name).Do().Into(result)
return
}
// Create creates new policyBinding. Returns the server's representation of the clusterPolicyBindings and error if one occurs.
func (c *clusterPolicyBindings) Create(policyBinding *authorizationapi.ClusterPolicyBinding) (result *authorizationapi.ClusterPolicyBinding, err error) {
result = &authorizationapi.ClusterPolicyBinding{}
err = c.r.Post().Resource("clusterPolicyBindings").Body(policyBinding).Do().Into(result)
return
}
// Delete deletes a policyBinding, returns error if one occurs.
func (c *clusterPolicyBindings) Delete(name string) (err error) {
err = c.r.Delete().Resource("clusterPolicyBindings").Name(name).Do().Error()
return
}
// Watch returns a watch.Interface that watches the requested clusterPolicyBindings
func (c *clusterPolicyBindings) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().Prefix("watch").Resource("clusterPolicyBindings").VersionedParams(&opts, kapi.ParameterCodec).Watch()
}
+66
View File
@@ -0,0 +1,66 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
// ClusterRoleBindingsInterface has methods to work with ClusterRoleBindings resources in a namespace
type ClusterRoleBindingsInterface interface {
ClusterRoleBindings() ClusterRoleBindingInterface
}
// ClusterRoleBindingInterface exposes methods on ClusterRoleBindings resources
type ClusterRoleBindingInterface interface {
List(opts kapi.ListOptions) (*authorizationapi.ClusterRoleBindingList, error)
Get(name string) (*authorizationapi.ClusterRoleBinding, error)
Update(roleBinding *authorizationapi.ClusterRoleBinding) (*authorizationapi.ClusterRoleBinding, error)
Create(roleBinding *authorizationapi.ClusterRoleBinding) (*authorizationapi.ClusterRoleBinding, error)
Delete(name string) error
}
type clusterRoleBindings struct {
r *Client
}
// newClusterRoleBindings returns a clusterRoleBindings
func newClusterRoleBindings(c *Client) *clusterRoleBindings {
return &clusterRoleBindings{
r: c,
}
}
// List returns a list of clusterRoleBindings that match the label and field selectors.
func (c *clusterRoleBindings) List(opts kapi.ListOptions) (result *authorizationapi.ClusterRoleBindingList, err error) {
result = &authorizationapi.ClusterRoleBindingList{}
err = c.r.Get().Resource("clusterRoleBindings").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular roleBinding and error if one occurs.
func (c *clusterRoleBindings) Get(name string) (result *authorizationapi.ClusterRoleBinding, err error) {
result = &authorizationapi.ClusterRoleBinding{}
err = c.r.Get().Resource("clusterRoleBindings").Name(name).Do().Into(result)
return
}
// Create creates new roleBinding. Returns the server's representation of the roleBinding and error if one occurs.
func (c *clusterRoleBindings) Create(roleBinding *authorizationapi.ClusterRoleBinding) (result *authorizationapi.ClusterRoleBinding, err error) {
result = &authorizationapi.ClusterRoleBinding{}
err = c.r.Post().Resource("clusterRoleBindings").Body(roleBinding).Do().Into(result)
return
}
// Update updates the roleBinding on server. Returns the server's representation of the roleBinding and error if one occurs.
func (c *clusterRoleBindings) Update(roleBinding *authorizationapi.ClusterRoleBinding) (result *authorizationapi.ClusterRoleBinding, err error) {
result = &authorizationapi.ClusterRoleBinding{}
err = c.r.Put().Resource("clusterRoleBindings").Name(roleBinding.Name).Body(roleBinding).Do().Into(result)
return
}
// Delete deletes a roleBinding, returns error if one occurs.
func (c *clusterRoleBindings) Delete(name string) (err error) {
err = c.r.Delete().Resource("clusterRoleBindings").Name(name).Do().Error()
return
}
+66
View File
@@ -0,0 +1,66 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
// ClusterRolesInterface has methods to work with ClusterRoles resources in a namespace
type ClusterRolesInterface interface {
ClusterRoles() ClusterRoleInterface
}
// ClusterRoleInterface exposes methods on ClusterRoles resources
type ClusterRoleInterface interface {
List(opts kapi.ListOptions) (*authorizationapi.ClusterRoleList, error)
Get(name string) (*authorizationapi.ClusterRole, error)
Create(role *authorizationapi.ClusterRole) (*authorizationapi.ClusterRole, error)
Update(role *authorizationapi.ClusterRole) (*authorizationapi.ClusterRole, error)
Delete(name string) error
}
type clusterRoles struct {
r *Client
}
// newClusterRoles returns a clusterRoles
func newClusterRoles(c *Client) *clusterRoles {
return &clusterRoles{
r: c,
}
}
// List returns a list of clusterRoles that match the label and field selectors.
func (c *clusterRoles) List(opts kapi.ListOptions) (result *authorizationapi.ClusterRoleList, err error) {
result = &authorizationapi.ClusterRoleList{}
err = c.r.Get().Resource("clusterRoles").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular role and error if one occurs.
func (c *clusterRoles) Get(name string) (result *authorizationapi.ClusterRole, err error) {
result = &authorizationapi.ClusterRole{}
err = c.r.Get().Resource("clusterRoles").Name(name).Do().Into(result)
return
}
// Create creates new role. Returns the server's representation of the role and error if one occurs.
func (c *clusterRoles) Create(role *authorizationapi.ClusterRole) (result *authorizationapi.ClusterRole, err error) {
result = &authorizationapi.ClusterRole{}
err = c.r.Post().Resource("clusterRoles").Body(role).Do().Into(result)
return
}
// Update updates the roleBinding on server. Returns the server's representation of the roleBinding and error if one occurs.
func (c *clusterRoles) Update(role *authorizationapi.ClusterRole) (result *authorizationapi.ClusterRole, err error) {
result = &authorizationapi.ClusterRole{}
err = c.r.Put().Resource("clusterRoles").Name(role.Name).Body(role).Do().Into(result)
return
}
// Delete deletes a role, returns error if one occurs.
func (c *clusterRoles) Delete(name string) (err error) {
err = c.r.Delete().Resource("clusterRoles").Name(name).Do().Error()
return
}
+176
View File
@@ -0,0 +1,176 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
extensionsv1beta1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
kclient "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/watch"
deployapi "github.com/openshift/origin/pkg/deploy/api"
)
// DeploymentConfigsNamespacer has methods to work with DeploymentConfig resources in a namespace
type DeploymentConfigsNamespacer interface {
DeploymentConfigs(namespace string) DeploymentConfigInterface
}
// DeploymentConfigInterface contains methods for working with DeploymentConfigs
type DeploymentConfigInterface interface {
List(opts kapi.ListOptions) (*deployapi.DeploymentConfigList, error)
Get(name string) (*deployapi.DeploymentConfig, error)
Create(config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error)
Update(config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
Generate(name string) (*deployapi.DeploymentConfig, error)
Rollback(config *deployapi.DeploymentConfigRollback) (*deployapi.DeploymentConfig, error)
RollbackDeprecated(config *deployapi.DeploymentConfigRollback) (*deployapi.DeploymentConfig, error)
GetScale(name string) (*extensions.Scale, error)
UpdateScale(scale *extensions.Scale) (*extensions.Scale, error)
UpdateStatus(config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error)
}
// deploymentConfigs implements DeploymentConfigsNamespacer interface
type deploymentConfigs struct {
r *Client
ns string
}
// newDeploymentConfigs returns a deploymentConfigs
func newDeploymentConfigs(c *Client, namespace string) *deploymentConfigs {
return &deploymentConfigs{
r: c,
ns: namespace,
}
}
// List takes a label and field selectors, and returns the list of deploymentConfigs that match that selectors
func (c *deploymentConfigs) List(opts kapi.ListOptions) (result *deployapi.DeploymentConfigList, err error) {
result = &deployapi.DeploymentConfigList{}
err = c.r.Get().
Namespace(c.ns).
Resource("deploymentConfigs").
VersionedParams(&opts, kapi.ParameterCodec).
Do().
Into(result)
return
}
// Get returns information about a particular deploymentConfig
func (c *deploymentConfigs) Get(name string) (result *deployapi.DeploymentConfig, err error) {
result = &deployapi.DeploymentConfig{}
err = c.r.Get().Namespace(c.ns).Resource("deploymentConfigs").Name(name).Do().Into(result)
return
}
// Create creates a new deploymentConfig
func (c *deploymentConfigs) Create(deploymentConfig *deployapi.DeploymentConfig) (result *deployapi.DeploymentConfig, err error) {
result = &deployapi.DeploymentConfig{}
err = c.r.Post().Namespace(c.ns).Resource("deploymentConfigs").Body(deploymentConfig).Do().Into(result)
return
}
// Update updates an existing deploymentConfig
func (c *deploymentConfigs) Update(deploymentConfig *deployapi.DeploymentConfig) (result *deployapi.DeploymentConfig, err error) {
result = &deployapi.DeploymentConfig{}
err = c.r.Put().Namespace(c.ns).Resource("deploymentConfigs").Name(deploymentConfig.Name).Body(deploymentConfig).Do().Into(result)
return
}
// Delete deletes an existing deploymentConfig.
func (c *deploymentConfigs) Delete(name string) error {
return c.r.Delete().Namespace(c.ns).Resource("deploymentConfigs").Name(name).Do().Error()
}
// Watch returns a watch.Interface that watches the requested deploymentConfigs.
func (c *deploymentConfigs) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("deploymentConfigs").
VersionedParams(&opts, kapi.ParameterCodec).
Watch()
}
// Generate generates a new deploymentConfig for the given name.
func (c *deploymentConfigs) Generate(name string) (result *deployapi.DeploymentConfig, err error) {
result = &deployapi.DeploymentConfig{}
err = c.r.Get().Namespace(c.ns).Resource("generateDeploymentConfigs").Name(name).Do().Into(result)
return
}
// Rollback rolls a deploymentConfig back to a previous configuration
func (c *deploymentConfigs) Rollback(config *deployapi.DeploymentConfigRollback) (result *deployapi.DeploymentConfig, err error) {
result = &deployapi.DeploymentConfig{}
err = c.r.Post().
Namespace(c.ns).
Resource("deploymentConfigs").
Name(config.Name).
SubResource("rollback").
Body(config).
Do().
Into(result)
return
}
// RollbackDeprecated rolls a deploymentConfig back to a previous configuration
func (c *deploymentConfigs) RollbackDeprecated(config *deployapi.DeploymentConfigRollback) (result *deployapi.DeploymentConfig, err error) {
result = &deployapi.DeploymentConfig{}
err = c.r.Post().
Namespace(c.ns).
Resource("deploymentConfigRollbacks").
Body(config).
Do().
Into(result)
return
}
// GetScale returns information about a particular deploymentConfig via its scale subresource
func (c *deploymentConfigs) GetScale(name string) (result *extensions.Scale, err error) {
result = &extensions.Scale{}
err = c.r.Get().Namespace(c.ns).Resource("deploymentConfigs").Name(name).SubResource("scale").Do().Into(result)
return
}
// UpdateScale scales an existing deploymentConfig via its scale subresource
func (c *deploymentConfigs) UpdateScale(scale *extensions.Scale) (result *extensions.Scale, err error) {
result = &extensions.Scale{}
// TODO fix by making the client understand how to encode using different codecs for different resources
encodedBytes, err := runtime.Encode(kapi.Codecs.LegacyCodec(extensionsv1beta1.SchemeGroupVersion), scale)
if err != nil {
return result, err
}
err = c.r.Put().Namespace(c.ns).Resource("deploymentConfigs").Name(scale.Name).SubResource("scale").Body(encodedBytes).Do().Into(result)
return
}
// UpdateStatus updates the status for an existing deploymentConfig.
func (c *deploymentConfigs) UpdateStatus(deploymentConfig *deployapi.DeploymentConfig) (result *deployapi.DeploymentConfig, err error) {
result = &deployapi.DeploymentConfig{}
err = c.r.Put().Namespace(c.ns).Resource("deploymentConfigs").Name(deploymentConfig.Name).SubResource("status").Body(deploymentConfig).Do().Into(result)
return
}
type updateConfigFunc func(d *deployapi.DeploymentConfig)
// UpdateConfigWithRetries will try to update a deployment config and ignore any update conflicts.
func UpdateConfigWithRetries(dn DeploymentConfigsNamespacer, namespace, name string, applyUpdate updateConfigFunc) (*deployapi.DeploymentConfig, error) {
var config *deployapi.DeploymentConfig
resultErr := kclient.RetryOnConflict(kclient.DefaultBackoff, func() error {
var err error
config, err = dn.DeploymentConfigs(namespace).Get(name)
if err != nil {
return err
}
// Apply the update, then attempt to push it to the apiserver.
applyUpdate(config)
config, err = dn.DeploymentConfigs(namespace).Update(config)
return err
})
return config, resultErr
}
+37
View File
@@ -0,0 +1,37 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/restclient"
"github.com/openshift/origin/pkg/deploy/api"
)
// DeploymentLogsNamespacer has methods to work with DeploymentLogs resources in a namespace
type DeploymentLogsNamespacer interface {
DeploymentLogs(namespace string) DeploymentLogInterface
}
// DeploymentLogInterface exposes methods on DeploymentLogs resources.
type DeploymentLogInterface interface {
Get(name string, opts api.DeploymentLogOptions) *restclient.Request
}
// deploymentLogs implements DeploymentLogsNamespacer interface
type deploymentLogs struct {
r *Client
ns string
}
// newDeploymentLogs returns a deploymentLogs
func newDeploymentLogs(c *Client, namespace string) *deploymentLogs {
return &deploymentLogs{
r: c,
ns: namespace,
}
}
// Get gets the deploymentlogs and return a deploymentLog request
func (c *deploymentLogs) Get(name string, opts api.DeploymentLogOptions) *restclient.Request {
return c.r.Get().Namespace(c.ns).Resource("deploymentConfigs").Name(name).SubResource("log").VersionedParams(&opts, kapi.ParameterCodec)
}
+68
View File
@@ -0,0 +1,68 @@
package client
import (
"net/url"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/client/typed/discovery"
)
// DiscoveryClient implements the functions that discovery server-supported API groups,
// versions and resources.
type DiscoveryClient struct {
*discovery.DiscoveryClient
}
// ServerResourcesForGroupVersion returns the supported resources for a group and version.
func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (resources *unversioned.APIResourceList, err error) {
parentList, err := d.DiscoveryClient.ServerResourcesForGroupVersion(groupVersion)
if err != nil {
return parentList, err
}
if groupVersion != "v1" {
return parentList, nil
}
// we request v1, we must combine the parent list with the list from /oapi
url := url.URL{}
url.Path = "/oapi/" + groupVersion
originResources := &unversioned.APIResourceList{}
err = d.Get().AbsPath(url.String()).Do().Into(originResources)
if err != nil {
// ignore 403 or 404 error to be compatible with an v1.0 server.
if groupVersion == "v1" && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
return parentList, nil
}
return nil, err
}
parentList.APIResources = append(parentList.APIResources, originResources.APIResources...)
return parentList, nil
}
// ServerResources returns the supported resources for all groups and versions.
func (d *DiscoveryClient) ServerResources() (map[string]*unversioned.APIResourceList, error) {
apiGroups, err := d.ServerGroups()
if err != nil {
return nil, err
}
groupVersions := unversioned.ExtractGroupVersions(apiGroups)
result := map[string]*unversioned.APIResourceList{}
for _, groupVersion := range groupVersions {
resources, err := d.ServerResourcesForGroupVersion(groupVersion)
if err != nil {
return nil, err
}
result[groupVersion] = resources
}
return result, nil
}
// New creates a new DiscoveryClient for the given RESTClient.
func NewDiscoveryClient(c *restclient.RESTClient) *DiscoveryClient {
return &DiscoveryClient{discovery.NewDiscoveryClient(c)}
}
+85
View File
@@ -0,0 +1,85 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
sdnapi "github.com/openshift/origin/pkg/sdn/api"
)
// EgressNetworkPoliciesNamespacer has methods to work with EgressNetworkPolicy resources in a namespace
type EgressNetworkPoliciesNamespacer interface {
EgressNetworkPolicies(namespace string) EgressNetworkPolicyInterface
}
// EgressNetworkPolicyInterface exposes methods on egressNetworkPolicy resources.
type EgressNetworkPolicyInterface interface {
List(opts kapi.ListOptions) (*sdnapi.EgressNetworkPolicyList, error)
Get(name string) (*sdnapi.EgressNetworkPolicy, error)
Create(sub *sdnapi.EgressNetworkPolicy) (*sdnapi.EgressNetworkPolicy, error)
Update(sub *sdnapi.EgressNetworkPolicy) (*sdnapi.EgressNetworkPolicy, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
// egressNetworkPolicy implements EgressNetworkPolicyInterface interface
type egressNetworkPolicy struct {
r *Client
ns string
}
// newEgressNetworkPolicy returns a egressNetworkPolicy
func newEgressNetworkPolicy(c *Client, namespace string) *egressNetworkPolicy {
return &egressNetworkPolicy{
r: c,
ns: namespace,
}
}
// List returns a list of EgressNetworkPolicy that match the label and field selectors.
func (c *egressNetworkPolicy) List(opts kapi.ListOptions) (result *sdnapi.EgressNetworkPolicyList, err error) {
result = &sdnapi.EgressNetworkPolicyList{}
err = c.r.Get().
Namespace(c.ns).
Resource("egressNetworkPolicies").
VersionedParams(&opts, kapi.ParameterCodec).
Do().
Into(result)
return
}
// Get returns information about a particular firewall
func (c *egressNetworkPolicy) Get(name string) (result *sdnapi.EgressNetworkPolicy, err error) {
result = &sdnapi.EgressNetworkPolicy{}
err = c.r.Get().Namespace(c.ns).Resource("egressNetworkPolicies").Name(name).Do().Into(result)
return
}
// Create creates a new EgressNetworkPolicy. Returns the server's representation of EgressNetworkPolicy and error if one occurs.
func (c *egressNetworkPolicy) Create(fw *sdnapi.EgressNetworkPolicy) (result *sdnapi.EgressNetworkPolicy, err error) {
result = &sdnapi.EgressNetworkPolicy{}
err = c.r.Post().Namespace(c.ns).Resource("egressNetworkPolicies").Body(fw).Do().Into(result)
return
}
// Update updates the EgressNetworkPolicy on the server. Returns the server's representation of the EgressNetworkPolicy and error if one occurs.
func (c *egressNetworkPolicy) Update(fw *sdnapi.EgressNetworkPolicy) (result *sdnapi.EgressNetworkPolicy, err error) {
result = &sdnapi.EgressNetworkPolicy{}
err = c.r.Put().Namespace(c.ns).Resource("egressNetworkPolicies").Name(fw.Name).Body(fw).Do().Into(result)
return
}
// Delete takes the name of the EgressNetworkPolicy, and returns an error if one occurs during deletion of the EgressNetworkPolicy
func (c *egressNetworkPolicy) Delete(name string) error {
return c.r.Delete().Namespace(c.ns).Resource("egressNetworkPolicies").Name(name).Do().Error()
}
// Watch returns a watch.Interface that watches the requested EgressNetworkPolicies
func (c *egressNetworkPolicy) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("egressNetworkPolicies").
VersionedParams(&opts, kapi.ParameterCodec).
Watch()
}
+81
View File
@@ -0,0 +1,81 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
userapi "github.com/openshift/origin/pkg/user/api"
)
// GroupsInterface has methods to work with Group resources
type GroupsInterface interface {
Groups() GroupInterface
}
// GroupInterface exposes methods on group resources.
type GroupInterface interface {
List(opts kapi.ListOptions) (*userapi.GroupList, error)
Get(name string) (*userapi.Group, error)
Create(group *userapi.Group) (*userapi.Group, error)
Update(group *userapi.Group) (*userapi.Group, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
// groups implements GroupInterface interface
type groups struct {
r *Client
}
// newGroups returns a groups
func newGroups(c *Client) *groups {
return &groups{
r: c,
}
}
// List returns a list of groups that match the label and field selectors.
func (c *groups) List(opts kapi.ListOptions) (result *userapi.GroupList, err error) {
result = &userapi.GroupList{}
err = c.r.Get().
Resource("groups").
VersionedParams(&opts, kapi.ParameterCodec).
Do().
Into(result)
return
}
// Get returns information about a particular group or an error
func (c *groups) Get(name string) (result *userapi.Group, err error) {
result = &userapi.Group{}
err = c.r.Get().Resource("groups").Name(name).Do().Into(result)
return
}
// Create creates a new group. Returns the server's representation of the group and error if one occurs.
func (c *groups) Create(group *userapi.Group) (result *userapi.Group, err error) {
result = &userapi.Group{}
err = c.r.Post().Resource("groups").Body(group).Do().Into(result)
return
}
// Update updates the group on server. Returns the server's representation of the group and error if one occurs.
func (c *groups) Update(group *userapi.Group) (result *userapi.Group, err error) {
result = &userapi.Group{}
err = c.r.Put().Resource("groups").Name(group.Name).Body(group).Do().Into(result)
return
}
// Delete takes the name of the groups, and returns an error if one occurs during deletion of the groups
func (c *groups) Delete(name string) error {
return c.r.Delete().Resource("groups").Name(name).Do().Error()
}
// Watch returns a watch.Interface that watches the requested groups.
func (c *groups) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Resource("groups").
VersionedParams(&opts, kapi.ParameterCodec).
Watch()
}
+81
View File
@@ -0,0 +1,81 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
sdnapi "github.com/openshift/origin/pkg/sdn/api"
)
// HostSubnetInterface has methods to work with HostSubnet resources
type HostSubnetsInterface interface {
HostSubnets() HostSubnetInterface
}
// HostSubnetInterface exposes methods on HostSubnet resources.
type HostSubnetInterface interface {
List(opts kapi.ListOptions) (*sdnapi.HostSubnetList, error)
Get(name string) (*sdnapi.HostSubnet, error)
Create(sub *sdnapi.HostSubnet) (*sdnapi.HostSubnet, error)
Update(sub *sdnapi.HostSubnet) (*sdnapi.HostSubnet, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
// hostSubnet implements HostSubnetInterface interface
type hostSubnet struct {
r *Client
}
// newHostSubnet returns a hostsubnet
func newHostSubnet(c *Client) *hostSubnet {
return &hostSubnet{
r: c,
}
}
// List returns a list of hostsubnets that match the label and field selectors.
func (c *hostSubnet) List(opts kapi.ListOptions) (result *sdnapi.HostSubnetList, err error) {
result = &sdnapi.HostSubnetList{}
err = c.r.Get().
Resource("hostSubnets").
VersionedParams(&opts, kapi.ParameterCodec).
Do().
Into(result)
return
}
// Get returns host subnet information for a given host or an error
func (c *hostSubnet) Get(hostName string) (result *sdnapi.HostSubnet, err error) {
result = &sdnapi.HostSubnet{}
err = c.r.Get().Resource("hostSubnets").Name(hostName).Do().Into(result)
return
}
// Create creates a new host subnet. Returns the server's representation of the host subnet and error if one occurs.
func (c *hostSubnet) Create(hostSubnet *sdnapi.HostSubnet) (result *sdnapi.HostSubnet, err error) {
result = &sdnapi.HostSubnet{}
err = c.r.Post().Resource("hostSubnets").Body(hostSubnet).Do().Into(result)
return
}
// Update updates existing host subnet. Returns the server's representation of the host subnet and error if one occurs.
func (c *hostSubnet) Update(hostSubnet *sdnapi.HostSubnet) (result *sdnapi.HostSubnet, err error) {
result = &sdnapi.HostSubnet{}
err = c.r.Put().Resource("hostSubnets").Name(hostSubnet.Name).Body(hostSubnet).Do().Into(result)
return
}
// Delete takes the name of the host, and returns an error if one occurs during deletion of the subnet
func (c *hostSubnet) Delete(name string) error {
return c.r.Delete().Resource("hostSubnets").Name(name).Do().Error()
}
// Watch returns a watch.Interface that watches the requested subnets
func (c *hostSubnet) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Resource("hostSubnets").
VersionedParams(&opts, kapi.ParameterCodec).
Watch()
}
+70
View File
@@ -0,0 +1,70 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
userapi "github.com/openshift/origin/pkg/user/api"
)
// IdentitiesInterface has methods to work with Identity resources
type IdentitiesInterface interface {
Identities() IdentityInterface
}
// IdentityInterface exposes methods on identity resources.
type IdentityInterface interface {
List(opts kapi.ListOptions) (*userapi.IdentityList, error)
Get(name string) (*userapi.Identity, error)
Create(identity *userapi.Identity) (*userapi.Identity, error)
Update(identity *userapi.Identity) (*userapi.Identity, error)
Delete(name string) error
}
// identities implements IdentityInterface interface
type identities struct {
r *Client
}
// newIdentities returns an identities client
func newIdentities(c *Client) *identities {
return &identities{
r: c,
}
}
// List returns a list of identities that match the label and field selectors.
func (c *identities) List(opts kapi.ListOptions) (result *userapi.IdentityList, err error) {
result = &userapi.IdentityList{}
err = c.r.Get().
Resource("identities").
VersionedParams(&opts, kapi.ParameterCodec).
Do().
Into(result)
return
}
// Get returns information about a particular identity or an error
func (c *identities) Get(name string) (result *userapi.Identity, err error) {
result = &userapi.Identity{}
err = c.r.Get().Resource("identities").Name(name).Do().Into(result)
return
}
// Create creates a new identity. Returns the server's representation of the identity and error if one occurs.
func (c *identities) Create(identity *userapi.Identity) (result *userapi.Identity, err error) {
result = &userapi.Identity{}
err = c.r.Post().Resource("identities").Body(identity).Do().Into(result)
return
}
// Update updates the identity on server. Returns the server's representation of the identity and error if one occurs.
func (c *identities) Update(identity *userapi.Identity) (result *userapi.Identity, err error) {
result = &userapi.Identity{}
err = c.r.Put().Resource("identities").Name(identity.Name).Body(identity).Do().Into(result)
return
}
// Delete deletes the identity on server. Returns an error if one occurs.
func (c *identities) Delete(name string) (err error) {
return c.r.Delete().Resource("identities").Name(name).Do().Error()
}
+72
View File
@@ -0,0 +1,72 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
imageapi "github.com/openshift/origin/pkg/image/api"
)
// ImagesInterfacer has methods to work with Image resources
type ImagesInterfacer interface {
Images() ImageInterface
}
// ImageInterface exposes methods on Image resources.
type ImageInterface interface {
List(opts kapi.ListOptions) (*imageapi.ImageList, error)
Get(name string) (*imageapi.Image, error)
Create(image *imageapi.Image) (*imageapi.Image, error)
Update(image *imageapi.Image) (*imageapi.Image, error)
Delete(name string) error
}
// images implements ImagesInterface.
type images struct {
r *Client
}
// newImages returns an images
func newImages(c *Client) ImageInterface {
return &images{
r: c,
}
}
// List returns a list of images that match the label and field selectors.
func (c *images) List(opts kapi.ListOptions) (result *imageapi.ImageList, err error) {
result = &imageapi.ImageList{}
err = c.r.Get().
Resource("images").
VersionedParams(&opts, kapi.ParameterCodec).
Do().
Into(result)
return
}
// Get returns information about a particular image and error if one occurs.
func (c *images) Get(name string) (result *imageapi.Image, err error) {
result = &imageapi.Image{}
err = c.r.Get().Resource("images").Name(name).Do().Into(result)
return
}
// Create creates a new image. Returns the server's representation of the image and error if one occurs.
func (c *images) Create(image *imageapi.Image) (result *imageapi.Image, err error) {
result = &imageapi.Image{}
err = c.r.Post().Resource("images").Body(image).Do().Into(result)
return
}
// Update allows to modify existing image. Since most of image's attributes are immutable, this call allows
// mainly for updating image signatures.
func (c *images) Update(image *imageapi.Image) (result *imageapi.Image, err error) {
result = &imageapi.Image{}
err = c.r.Put().Resource("images").Name(image.Name).Body(image).Do().Into(result)
return
}
// Delete deletes an image, returns error if one occurs.
func (c *images) Delete(name string) (err error) {
err = c.r.Delete().Resource("images").Name(name).Do().Error()
return
}
+41
View File
@@ -0,0 +1,41 @@
package client
import (
imageapi "github.com/openshift/origin/pkg/image/api"
)
// ImageSignaturesInterfacer has methods to work with ImageSignature resource.
type ImageSignaturesInterfacer interface {
ImageSignatures() ImageSignatureInterface
}
// ImageSignatureInterface exposes methods on ImageSignature virtual resource.
type ImageSignatureInterface interface {
Create(signature *imageapi.ImageSignature) (*imageapi.ImageSignature, error)
Delete(name string) error
}
// imageSignatures implements ImageSignatureInterface.
type imageSignatures struct {
r *Client
}
// newImageSignatures returns imageSignatures
func newImageSignatures(c *Client) ImageSignatureInterface {
return &imageSignatures{
r: c,
}
}
// Create creates a new ImageSignature. Returns the server's representation of the signature and error if one
// occurs.
func (c *imageSignatures) Create(signature *imageapi.ImageSignature) (result *imageapi.ImageSignature, err error) {
result = &imageapi.ImageSignature{}
err = c.r.Post().Resource("imageSignatures").Body(signature).Do().Into(result)
return
}
// Delete deletes an ImageSignature, returns error if one occurs.
func (c *imageSignatures) Delete(name string) error {
return c.r.Delete().Resource("imageSignatures").Name(name).Do().Error()
}
+36
View File
@@ -0,0 +1,36 @@
package client
import (
"github.com/openshift/origin/pkg/image/api"
)
// ImageStreamImagesNamespacer has methods to work with ImageStreamImage resources in a namespace
type ImageStreamImagesNamespacer interface {
ImageStreamImages(namespace string) ImageStreamImageInterface
}
// ImageStreamImageInterface exposes methods on ImageStreamImage resources.
type ImageStreamImageInterface interface {
Get(name, id string) (*api.ImageStreamImage, error)
}
// imageStreamImages implements ImageStreamImagesNamespacer interface
type imageStreamImages struct {
r *Client
ns string
}
// newImageStreamImages returns an imageStreamImages
func newImageStreamImages(c *Client, namespace string) *imageStreamImages {
return &imageStreamImages{
r: c,
ns: namespace,
}
}
// Get finds the specified image by name of an image repository and id.
func (c *imageStreamImages) Get(name, id string) (result *api.ImageStreamImage, err error) {
result = &api.ImageStreamImage{}
err = c.r.Get().Namespace(c.ns).Resource("imageStreamImages").Name(api.MakeImageStreamImageName(name, id)).Do().Into(result)
return
}
+34
View File
@@ -0,0 +1,34 @@
package client
import (
imageapi "github.com/openshift/origin/pkg/image/api"
)
// ImageStreamMappingsNamespacer has methods to work with ImageStreamMapping resources in a namespace
type ImageStreamMappingsNamespacer interface {
ImageStreamMappings(namespace string) ImageStreamMappingInterface
}
// ImageStreamMappingInterface exposes methods on ImageStreamMapping resources.
type ImageStreamMappingInterface interface {
Create(mapping *imageapi.ImageStreamMapping) error
}
// imageStreamMappings implements ImageStreamMappingsNamespacer interface
type imageStreamMappings struct {
r *Client
ns string
}
// newImageStreamMappings returns an imageStreamMappings
func newImageStreamMappings(c *Client, namespace string) *imageStreamMappings {
return &imageStreamMappings{
r: c,
ns: namespace,
}
}
// Create creates a new image stream mapping on the server. Returns error if one occurs.
func (c *imageStreamMappings) Create(mapping *imageapi.ImageStreamMapping) error {
return c.r.Post().Namespace(c.ns).Resource("imageStreamMappings").Body(mapping).Do().Error()
}
+147
View File
@@ -0,0 +1,147 @@
package client
import (
"errors"
kapi "k8s.io/kubernetes/pkg/api"
apierrs "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/watch"
imageapi "github.com/openshift/origin/pkg/image/api"
quotautil "github.com/openshift/origin/pkg/quota/util"
)
var ErrImageStreamImportUnsupported = errors.New("the server does not support directly importing images - create an image stream with tags or the dockerImageRepository field set")
// ImageStreamsNamespacer has methods to work with ImageStream resources in a namespace
type ImageStreamsNamespacer interface {
ImageStreams(namespace string) ImageStreamInterface
}
// ImageStreamInterface exposes methods on ImageStream resources.
type ImageStreamInterface interface {
List(opts kapi.ListOptions) (*imageapi.ImageStreamList, error)
Get(name string) (*imageapi.ImageStream, error)
Create(stream *imageapi.ImageStream) (*imageapi.ImageStream, error)
Update(stream *imageapi.ImageStream) (*imageapi.ImageStream, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
UpdateStatus(stream *imageapi.ImageStream) (*imageapi.ImageStream, error)
Import(isi *imageapi.ImageStreamImport) (*imageapi.ImageStreamImport, error)
}
// ImageStreamNamespaceGetter exposes methods to get ImageStreams by Namespace
type ImageStreamNamespaceGetter interface {
GetByNamespace(namespace, name string) (*imageapi.ImageStream, error)
}
// imageStreams implements ImageStreamsNamespacer interface
type imageStreams struct {
r *Client
ns string
}
// newImageStreams returns an imageStreams
func newImageStreams(c *Client, namespace string) *imageStreams {
return &imageStreams{
r: c,
ns: namespace,
}
}
// List returns a list of image streams that match the label and field selectors.
func (c *imageStreams) List(opts kapi.ListOptions) (result *imageapi.ImageStreamList, err error) {
result = &imageapi.ImageStreamList{}
err = c.r.Get().
Namespace(c.ns).
Resource("imageStreams").
VersionedParams(&opts, kapi.ParameterCodec).
Do().
Into(result)
return
}
// Get returns information about a particular image stream and error if one occurs.
func (c *imageStreams) Get(name string) (result *imageapi.ImageStream, err error) {
result = &imageapi.ImageStream{}
err = c.r.Get().Namespace(c.ns).Resource("imageStreams").Name(name).Do().Into(result)
return
}
// GetByNamespace returns information about a particular image stream in a particular namespace and error if one occurs.
func (c *imageStreams) GetByNamespace(namespace, name string) (result *imageapi.ImageStream, err error) {
result = &imageapi.ImageStream{}
c.r.Get().Namespace(namespace).Resource("imageStreams").Name(name).Do().Into(result)
return
}
// Create create a new image stream. Returns the server's representation of the image stream and error if one occurs.
func (c *imageStreams) Create(stream *imageapi.ImageStream) (result *imageapi.ImageStream, err error) {
result = &imageapi.ImageStream{}
err = c.r.Post().Namespace(c.ns).Resource("imageStreams").Body(stream).Do().Into(result)
return
}
// Update updates the image stream on the server. Returns the server's representation of the image stream and error if one occurs.
func (c *imageStreams) Update(stream *imageapi.ImageStream) (result *imageapi.ImageStream, err error) {
result = &imageapi.ImageStream{}
err = c.r.Put().Namespace(c.ns).Resource("imageStreams").Name(stream.Name).Body(stream).Do().Into(result)
return
}
// Delete deletes an image stream, returns error if one occurs.
func (c *imageStreams) Delete(name string) (err error) {
err = c.r.Delete().Namespace(c.ns).Resource("imageStreams").Name(name).Do().Error()
return
}
// Watch returns a watch.Interface that watches the requested image streams.
func (c *imageStreams) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("imageStreams").
VersionedParams(&opts, kapi.ParameterCodec).
Watch()
}
// UpdateStatus updates the image stream's status. Returns the server's representation of the image stream, and an error, if it occurs.
func (c *imageStreams) UpdateStatus(stream *imageapi.ImageStream) (result *imageapi.ImageStream, err error) {
result = &imageapi.ImageStream{}
err = c.r.Put().Namespace(c.ns).Resource("imageStreams").Name(stream.Name).SubResource("status").Body(stream).Do().Into(result)
return
}
// Import makes a call to the server to retrieve information about the requested images or to perform an import. ImageStreamImport
// will be returned if no actual import was requested (the to fields were not set), or an ImageStream if import was requested.
func (c *imageStreams) Import(isi *imageapi.ImageStreamImport) (*imageapi.ImageStreamImport, error) {
result := &imageapi.ImageStreamImport{}
if err := c.r.Post().Namespace(c.ns).Resource("imageStreamImports").Body(isi).Do().Into(result); err != nil {
return nil, transformUnsupported(err)
}
return result, nil
}
// transformUnsupported converts specific error conditions to unsupported
func transformUnsupported(err error) error {
if err == nil {
return nil
}
if apierrs.IsNotFound(err) {
status, ok := err.(apierrs.APIStatus)
if !ok {
return ErrImageStreamImportUnsupported
}
if status.Status().Details == nil || status.Status().Details.Kind == "" {
return ErrImageStreamImportUnsupported
}
}
// The ImageStreamImport resource exists in v1.1.1 of origin but is not yet
// enabled by policy. A create request will return a Forbidden(403) error.
// We want to return ErrImageStreamImportUnsupported to allow fallback behavior
// in clients.
if apierrs.IsForbidden(err) && !quotautil.IsErrorQuotaExceeded(err) {
return ErrImageStreamImportUnsupported
}
return err
}
+44
View File
@@ -0,0 +1,44 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
)
// ImageStreamSecretsNamespacer has methods to work with ImageStreamSecret resources in a namespace
type ImageStreamSecretsNamespacer interface {
ImageStreamSecrets(namespace string) ImageStreamSecretInterface
}
// ImageStreamSecretInterface exposes methods on ImageStreamSecret resources.
type ImageStreamSecretInterface interface {
// Secrets retrieves the secrets for a named image stream with the provided list options.
Secrets(name string, options kapi.ListOptions) (*kapi.SecretList, error)
}
// imageStreamSecrets implements ImageStreamSecretsNamespacer interface
type imageStreamSecrets struct {
r *Client
ns string
}
// newImageStreamSecrets returns an imageStreamSecrets
func newImageStreamSecrets(c *Client, namespace string) *imageStreamSecrets {
return &imageStreamSecrets{
r: c,
ns: namespace,
}
}
// GetSecrets returns a list of secrets for the named image stream
func (c *imageStreamSecrets) Secrets(name string, options kapi.ListOptions) (result *kapi.SecretList, err error) {
result = &kapi.SecretList{}
err = c.r.Get().
Namespace(c.ns).
Resource("imageStreams").
Name(name).
SubResource("secrets").
VersionedParams(&options, kapi.ParameterCodec).
Do().
Into(result)
return
}
+57
View File
@@ -0,0 +1,57 @@
package client
import (
"github.com/openshift/origin/pkg/image/api"
)
// ImageStreamTagsNamespacer has methods to work with ImageStreamTag resources in a namespace
type ImageStreamTagsNamespacer interface {
ImageStreamTags(namespace string) ImageStreamTagInterface
}
// ImageStreamTagInterface exposes methods on ImageStreamTag resources.
type ImageStreamTagInterface interface {
Get(name, tag string) (*api.ImageStreamTag, error)
Create(tag *api.ImageStreamTag) (*api.ImageStreamTag, error)
Update(tag *api.ImageStreamTag) (*api.ImageStreamTag, error)
Delete(name, tag string) error
}
// imageStreamTags implements ImageStreamTagsNamespacer interface
type imageStreamTags struct {
r *Client
ns string
}
// newImageStreamTags returns an imageStreamTags
func newImageStreamTags(c *Client, namespace string) *imageStreamTags {
return &imageStreamTags{
r: c,
ns: namespace,
}
}
// Get finds the specified image by name of an image stream and tag.
func (c *imageStreamTags) Get(name, tag string) (result *api.ImageStreamTag, err error) {
result = &api.ImageStreamTag{}
err = c.r.Get().Namespace(c.ns).Resource("imageStreamTags").Name(api.JoinImageStreamTag(name, tag)).Do().Into(result)
return
}
// Update updates an image stream tag (creating it if it does not exist).
func (c *imageStreamTags) Update(tag *api.ImageStreamTag) (result *api.ImageStreamTag, err error) {
result = &api.ImageStreamTag{}
err = c.r.Put().Namespace(c.ns).Resource("imageStreamTags").Name(tag.Name).Body(tag).Do().Into(result)
return
}
func (c *imageStreamTags) Create(tag *api.ImageStreamTag) (result *api.ImageStreamTag, err error) {
result = &api.ImageStreamTag{}
err = c.r.Post().Namespace(c.ns).Resource("imageStreamTags").Body(tag).Do().Into(result)
return
}
// Delete deletes the specified tag from the image stream.
func (c *imageStreamTags) Delete(name, tag string) error {
return c.r.Delete().Namespace(c.ns).Resource("imageStreamTags").Name(api.JoinImageStreamTag(name, tag)).Do().Error()
}
@@ -0,0 +1,51 @@
package client
import (
kapierrors "k8s.io/kubernetes/pkg/api/errors"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
// LocalResourceAccessReviewsNamespacer has methods to work with LocalResourceAccessReview resources in a namespace
type LocalResourceAccessReviewsNamespacer interface {
LocalResourceAccessReviews(namespace string) LocalResourceAccessReviewInterface
}
// LocalResourceAccessReviewInterface exposes methods on LocalResourceAccessReview resources.
type LocalResourceAccessReviewInterface interface {
Create(policy *authorizationapi.LocalResourceAccessReview) (*authorizationapi.ResourceAccessReviewResponse, error)
}
// localResourceAccessReviews implements ResourceAccessReviewsNamespacer interface
type localResourceAccessReviews struct {
r *Client
ns string
}
// newLocalResourceAccessReviews returns a localLocalResourceAccessReviews
func newLocalResourceAccessReviews(c *Client, namespace string) *localResourceAccessReviews {
return &localResourceAccessReviews{
r: c,
ns: namespace,
}
}
func (c *localResourceAccessReviews) Create(rar *authorizationapi.LocalResourceAccessReview) (result *authorizationapi.ResourceAccessReviewResponse, err error) {
result = &authorizationapi.ResourceAccessReviewResponse{}
err = c.r.Post().Namespace(c.ns).Resource("localResourceAccessReviews").Body(rar).Do().Into(result)
// if we get one of these failures, we may be talking to an older openshift. In that case, we need to try hitting ns/namespace-name/subjectaccessreview
if kapierrors.IsForbidden(err) || kapierrors.IsNotFound(err) {
deprecatedRAR := &authorizationapi.ResourceAccessReview{
Action: rar.Action,
}
deprecatedResponse := &authorizationapi.ResourceAccessReviewResponse{}
deprecatedAttemptErr := c.r.Post().Namespace(c.ns).Resource("resourceAccessReviews").Body(deprecatedRAR).Do().Into(deprecatedResponse)
if deprecatedAttemptErr == nil {
err = nil
result = deprecatedResponse
}
}
return
}
@@ -0,0 +1,78 @@
package client
import (
kapierrors "k8s.io/kubernetes/pkg/api/errors"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
type LocalSubjectAccessReviewsImpersonator interface {
ImpersonateLocalSubjectAccessReviews(namespace, token string) LocalSubjectAccessReviewInterface
}
// LocalSubjectAccessReviewsNamespacer has methods to work with LocalSubjectAccessReview resources in a namespace
type LocalSubjectAccessReviewsNamespacer interface {
LocalSubjectAccessReviews(namespace string) LocalSubjectAccessReviewInterface
}
// LocalSubjectAccessReviewInterface exposes methods on LocalSubjectAccessReview resources.
type LocalSubjectAccessReviewInterface interface {
Create(policy *authorizationapi.LocalSubjectAccessReview) (*authorizationapi.SubjectAccessReviewResponse, error)
}
// localSubjectAccessReviews implements LocalSubjectAccessReviewsNamespacer interface
type localSubjectAccessReviews struct {
r *Client
ns string
token *string
}
// newImpersonatingLocalSubjectAccessReviews returns a subjectAccessReviews
func newImpersonatingLocalSubjectAccessReviews(c *Client, namespace, token string) *localSubjectAccessReviews {
return &localSubjectAccessReviews{
r: c,
ns: namespace,
token: &token,
}
}
// newLocalSubjectAccessReviews returns a localSubjectAccessReviews
func newLocalSubjectAccessReviews(c *Client, namespace string) *localSubjectAccessReviews {
return &localSubjectAccessReviews{
r: c,
ns: namespace,
}
}
func (c *localSubjectAccessReviews) Create(sar *authorizationapi.LocalSubjectAccessReview) (*authorizationapi.SubjectAccessReviewResponse, error) {
result := &authorizationapi.SubjectAccessReviewResponse{}
req, err := overrideAuth(c.token, c.r.Post().Namespace(c.ns).Resource("localSubjectAccessReviews"))
if err != nil {
return &authorizationapi.SubjectAccessReviewResponse{}, err
}
err = req.Body(sar).Do().Into(result)
// if we get one of these failures, we may be talking to an older openshift. In that case, we need to try hitting ns/namespace-name/subjectaccessreview
if kapierrors.IsForbidden(err) || kapierrors.IsNotFound(err) {
deprecatedSAR := &authorizationapi.SubjectAccessReview{
Action: sar.Action,
User: sar.User,
Groups: sar.Groups,
}
deprecatedResponse := &authorizationapi.SubjectAccessReviewResponse{}
deprecatedReq, deprecatedAttemptErr := overrideAuth(c.token, c.r.Post().Namespace(c.ns).Resource("subjectAccessReviews"))
if deprecatedAttemptErr != nil {
return &authorizationapi.SubjectAccessReviewResponse{}, deprecatedAttemptErr
}
deprecatedAttemptErr = deprecatedReq.Body(deprecatedSAR).Do().Into(deprecatedResponse)
if deprecatedAttemptErr == nil {
err = nil
result = deprecatedResponse
}
}
return result, err
}
+26
View File
@@ -0,0 +1,26 @@
package client
import (
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/apimachinery/registered"
"k8s.io/kubernetes/pkg/util/sets"
)
// DefaultMultiRESTMapper returns the multi REST mapper with all OpenShift and
// Kubernetes objects already registered.
func DefaultMultiRESTMapper() meta.MultiRESTMapper {
var restMapper meta.MultiRESTMapper
seenGroups := sets.String{}
for _, gv := range registered.EnabledVersions() {
if seenGroups.Has(gv.Group) {
continue
}
seenGroups.Insert(gv.Group)
groupMeta, err := registered.Group(gv.Group)
if err != nil {
continue
}
restMapper = meta.MultiRESTMapper(append(restMapper, groupMeta.RESTMapper))
}
return restMapper
}
+81
View File
@@ -0,0 +1,81 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
sdnapi "github.com/openshift/origin/pkg/sdn/api"
)
// NetNamespaceInterface has methods to work with NetNamespace resources
type NetNamespacesInterface interface {
NetNamespaces() NetNamespaceInterface
}
// NetNamespaceInterface exposes methods on NetNamespace resources.
type NetNamespaceInterface interface {
List(opts kapi.ListOptions) (*sdnapi.NetNamespaceList, error)
Get(name string) (*sdnapi.NetNamespace, error)
Create(sub *sdnapi.NetNamespace) (*sdnapi.NetNamespace, error)
Update(sub *sdnapi.NetNamespace) (*sdnapi.NetNamespace, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
// netNamespace implements NetNamespaceInterface interface
type netNamespace struct {
r *Client
}
// newNetNamespace returns a NetNamespace
func newNetNamespace(c *Client) *netNamespace {
return &netNamespace{
r: c,
}
}
// List returns a list of NetNamespaces that match the label and field selectors.
func (c *netNamespace) List(opts kapi.ListOptions) (result *sdnapi.NetNamespaceList, err error) {
result = &sdnapi.NetNamespaceList{}
err = c.r.Get().
Resource("netNamespaces").
VersionedParams(&opts, kapi.ParameterCodec).
Do().
Into(result)
return
}
// Get returns information about a particular NetNamespace or an error
func (c *netNamespace) Get(netname string) (result *sdnapi.NetNamespace, err error) {
result = &sdnapi.NetNamespace{}
err = c.r.Get().Resource("netNamespaces").Name(netname).Do().Into(result)
return
}
// Create creates a new NetNamespace. Returns the server's representation of the NetNamespace and error if one occurs.
func (c *netNamespace) Create(netNamespace *sdnapi.NetNamespace) (result *sdnapi.NetNamespace, err error) {
result = &sdnapi.NetNamespace{}
err = c.r.Post().Resource("netNamespaces").Body(netNamespace).Do().Into(result)
return
}
// Update updates the NetNamespace. Returns the server's representation of the NetNamespace and error if one occurs.
func (c *netNamespace) Update(netNamespace *sdnapi.NetNamespace) (result *sdnapi.NetNamespace, err error) {
result = &sdnapi.NetNamespace{}
err = c.r.Put().Resource("netNamespaces").Name(netNamespace.Name).Body(netNamespace).Do().Into(result)
return
}
// Delete takes the name of the NetNamespace, and returns an error if one occurs during deletion of the NetNamespace
func (c *netNamespace) Delete(name string) error {
return c.r.Delete().Resource("netNamespaces").Name(name).Do().Error()
}
// Watch returns a watch.Interface that watches the requested NetNamespaces
func (c *netNamespace) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Resource("netNamespaces").
VersionedParams(&opts, kapi.ParameterCodec).
Watch()
}
+46
View File
@@ -0,0 +1,46 @@
package client
import (
oauthapi "github.com/openshift/origin/pkg/oauth/api"
)
// OAuthAccessTokensInterface has methods to work with OAuthAccessTokens resources in a namespace
type OAuthAccessTokensInterface interface {
OAuthAccessTokens() OAuthAccessTokenInterface
}
// OAuthAccessTokenInterface exposes methods on OAuthAccessTokens resources.
type OAuthAccessTokenInterface interface {
Create(token *oauthapi.OAuthAccessToken) (*oauthapi.OAuthAccessToken, error)
Get(name string) (*oauthapi.OAuthAccessToken, error)
Delete(name string) error
}
type oauthAccessTokenInterface struct {
r *Client
}
func newOAuthAccessTokens(c *Client) *oauthAccessTokenInterface {
return &oauthAccessTokenInterface{
r: c,
}
}
// Get returns information about a particular image and error if one occurs.
func (c *oauthAccessTokenInterface) Get(name string) (result *oauthapi.OAuthAccessToken, err error) {
result = &oauthapi.OAuthAccessToken{}
err = c.r.Get().Resource("oAuthAccessTokens").Name(name).Do().Into(result)
return
}
// Delete removes the OAuthAccessToken on server
func (c *oauthAccessTokenInterface) Delete(name string) (err error) {
err = c.r.Delete().Resource("oAuthAccessTokens").Name(name).Do().Error()
return
}
func (c *oauthAccessTokenInterface) Create(token *oauthapi.OAuthAccessToken) (result *oauthapi.OAuthAccessToken, err error) {
result = &oauthapi.OAuthAccessToken{}
err = c.r.Post().Resource("oAuthAccessTokens").Body(token).Do().Into(result)
return
}
+35
View File
@@ -0,0 +1,35 @@
package client
import (
oauthapi "github.com/openshift/origin/pkg/oauth/api"
)
type OAuthAuthorizeTokensInterface interface {
OAuthAuthorizeTokens() OAuthAuthorizeTokenInterface
}
type OAuthAuthorizeTokenInterface interface {
Create(token *oauthapi.OAuthAuthorizeToken) (*oauthapi.OAuthAuthorizeToken, error)
Delete(name string) error
}
type oauthAuthorizeTokenInterface struct {
r *Client
}
func newOAuthAuthorizeTokens(c *Client) *oauthAuthorizeTokenInterface {
return &oauthAuthorizeTokenInterface{
r: c,
}
}
func (c *oauthAuthorizeTokenInterface) Delete(name string) (err error) {
err = c.r.Delete().Resource("oAuthAuthorizeTokens").Name(name).Do().Error()
return
}
func (c *oauthAuthorizeTokenInterface) Create(token *oauthapi.OAuthAuthorizeToken) (result *oauthapi.OAuthAuthorizeToken, err error) {
result = &oauthapi.OAuthAuthorizeToken{}
err = c.r.Post().Resource("oAuthAuthorizeTokens").Body(token).Do().Into(result)
return
}
+57
View File
@@ -0,0 +1,57 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
oauthapi "github.com/openshift/origin/pkg/oauth/api"
)
type OAuthClientsInterface interface {
OAuthClients() OAuthClientInterface
}
type OAuthClientInterface interface {
Create(obj *oauthapi.OAuthClient) (*oauthapi.OAuthClient, error)
List(opts kapi.ListOptions) (*oauthapi.OAuthClientList, error)
Get(name string) (*oauthapi.OAuthClient, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
type oauthClients struct {
r *Client
}
func newOAuthClients(c *Client) *oauthClients {
return &oauthClients{
r: c,
}
}
func (c *oauthClients) Create(obj *oauthapi.OAuthClient) (result *oauthapi.OAuthClient, err error) {
result = &oauthapi.OAuthClient{}
err = c.r.Post().Resource("oAuthClients").Body(obj).Do().Into(result)
return
}
func (c *oauthClients) List(opts kapi.ListOptions) (result *oauthapi.OAuthClientList, err error) {
result = &oauthapi.OAuthClientList{}
err = c.r.Get().Resource("oAuthClients").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
func (c *oauthClients) Get(name string) (result *oauthapi.OAuthClient, err error) {
result = &oauthapi.OAuthClient{}
err = c.r.Get().Resource("oAuthClients").Name(name).Do().Into(result)
return
}
func (c *oauthClients) Delete(name string) (err error) {
err = c.r.Delete().Resource("oAuthClients").Name(name).Do().Error()
return
}
func (c *oauthClients) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().Prefix("watch").Resource("oAuthClients").VersionedParams(&opts, kapi.ParameterCodec).Watch()
}
@@ -0,0 +1,64 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
oauthapi "github.com/openshift/origin/pkg/oauth/api"
)
type OAuthClientAuthorizationsInterface interface {
OAuthClientAuthorizations() OAuthClientAuthorizationInterface
}
type OAuthClientAuthorizationInterface interface {
Create(obj *oauthapi.OAuthClientAuthorization) (*oauthapi.OAuthClientAuthorization, error)
List(opts kapi.ListOptions) (*oauthapi.OAuthClientAuthorizationList, error)
Get(name string) (*oauthapi.OAuthClientAuthorization, error)
Update(obj *oauthapi.OAuthClientAuthorization) (*oauthapi.OAuthClientAuthorization, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
type oauthClientAuthorizations struct {
r *Client
}
func newOAuthClientAuthorizations(c *Client) *oauthClientAuthorizations {
return &oauthClientAuthorizations{
r: c,
}
}
func (c *oauthClientAuthorizations) Create(obj *oauthapi.OAuthClientAuthorization) (result *oauthapi.OAuthClientAuthorization, err error) {
result = &oauthapi.OAuthClientAuthorization{}
err = c.r.Post().Resource("oAuthClientAuthorizations").Body(obj).Do().Into(result)
return
}
func (c *oauthClientAuthorizations) Update(obj *oauthapi.OAuthClientAuthorization) (result *oauthapi.OAuthClientAuthorization, err error) {
result = &oauthapi.OAuthClientAuthorization{}
err = c.r.Put().Resource("oAuthClientAuthorizations").Name(obj.Name).Body(obj).Do().Into(result)
return
}
func (c *oauthClientAuthorizations) List(opts kapi.ListOptions) (result *oauthapi.OAuthClientAuthorizationList, err error) {
result = &oauthapi.OAuthClientAuthorizationList{}
err = c.r.Get().Resource("oAuthClientAuthorizations").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
func (c *oauthClientAuthorizations) Get(name string) (result *oauthapi.OAuthClientAuthorization, err error) {
result = &oauthapi.OAuthClientAuthorization{}
err = c.r.Get().Resource("oAuthClientAuthorizations").Name(name).Do().Into(result)
return
}
func (c *oauthClientAuthorizations) Delete(name string) (err error) {
err = c.r.Delete().Resource("oAuthClientAuthorizations").Name(name).Do().Error()
return
}
func (c *oauthClientAuthorizations) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().Prefix("watch").Resource("oAuthClientAuthorizations").VersionedParams(&opts, kapi.ParameterCodec).Watch()
}
+72
View File
@@ -0,0 +1,72 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
// PoliciesNamespacer has methods to work with Policy resources in a namespace
type PoliciesNamespacer interface {
Policies(namespace string) PolicyInterface
}
// PolicyInterface exposes methods on Policy resources.
type PolicyInterface interface {
List(opts kapi.ListOptions) (*authorizationapi.PolicyList, error)
Get(name string) (*authorizationapi.Policy, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
type PoliciesListerNamespacer interface {
Policies(namespace string) PolicyLister
}
type SyncedPoliciesListerNamespacer interface {
PoliciesListerNamespacer
LastSyncResourceVersion() string
}
type PolicyLister interface {
List(options kapi.ListOptions) (*authorizationapi.PolicyList, error)
Get(name string) (*authorizationapi.Policy, error)
}
// policies implements PoliciesNamespacer interface
type policies struct {
r *Client
ns string
}
// newPolicies returns a policies
func newPolicies(c *Client, namespace string) *policies {
return &policies{
r: c,
ns: namespace,
}
}
// List returns a list of policies that match the label and field selectors.
func (c *policies) List(opts kapi.ListOptions) (result *authorizationapi.PolicyList, err error) {
result = &authorizationapi.PolicyList{}
err = c.r.Get().Namespace(c.ns).Resource("policies").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular policy and error if one occurs.
func (c *policies) Get(name string) (result *authorizationapi.Policy, err error) {
result = &authorizationapi.Policy{}
err = c.r.Get().Namespace(c.ns).Resource("policies").Name(name).Do().Into(result)
return
}
// Delete deletes a policy, returns error if one occurs.
func (c *policies) Delete(name string) (err error) {
err = c.r.Delete().Namespace(c.ns).Resource("policies").Name(name).Do().Error()
return
}
// Watch returns a watch.Interface that watches the requested policies
func (c *policies) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().Prefix("watch").Namespace(c.ns).Resource("policies").VersionedParams(&opts, kapi.ParameterCodec).Watch()
}
+80
View File
@@ -0,0 +1,80 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
// PolicyBindingsNamespacer has methods to work with PolicyBinding resources in a namespace
type PolicyBindingsNamespacer interface {
PolicyBindings(namespace string) PolicyBindingInterface
}
// PolicyBindingInterface exposes methods on PolicyBinding resources.
type PolicyBindingInterface interface {
List(opts kapi.ListOptions) (*authorizationapi.PolicyBindingList, error)
Get(name string) (*authorizationapi.PolicyBinding, error)
Create(policyBinding *authorizationapi.PolicyBinding) (*authorizationapi.PolicyBinding, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
type PolicyBindingsListerNamespacer interface {
PolicyBindings(namespace string) PolicyBindingLister
}
type SyncedPolicyBindingsListerNamespacer interface {
PolicyBindingsListerNamespacer
LastSyncResourceVersion() string
}
type PolicyBindingLister interface {
List(options kapi.ListOptions) (*authorizationapi.PolicyBindingList, error)
Get(name string) (*authorizationapi.PolicyBinding, error)
}
// policyBindings implements PolicyBindingsNamespacer interface
type policyBindings struct {
r *Client
ns string
}
// newPolicyBindings returns a policyBindings
func newPolicyBindings(c *Client, namespace string) *policyBindings {
return &policyBindings{
r: c,
ns: namespace,
}
}
// List returns a list of policyBindings that match the label and field selectors.
func (c *policyBindings) List(opts kapi.ListOptions) (result *authorizationapi.PolicyBindingList, err error) {
result = &authorizationapi.PolicyBindingList{}
err = c.r.Get().Namespace(c.ns).Resource("policyBindings").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular policyBinding and error if one occurs.
func (c *policyBindings) Get(name string) (result *authorizationapi.PolicyBinding, err error) {
result = &authorizationapi.PolicyBinding{}
err = c.r.Get().Namespace(c.ns).Resource("policyBindings").Name(name).Do().Into(result)
return
}
// Create creates new policyBinding. Returns the server's representation of the policyBinding and error if one occurs.
func (c *policyBindings) Create(policyBinding *authorizationapi.PolicyBinding) (result *authorizationapi.PolicyBinding, err error) {
result = &authorizationapi.PolicyBinding{}
err = c.r.Post().Namespace(c.ns).Resource("policyBindings").Body(policyBinding).Do().Into(result)
return
}
// Delete deletes a policyBinding, returns error if one occurs.
func (c *policyBindings) Delete(name string) (err error) {
err = c.r.Delete().Namespace(c.ns).Resource("policyBindings").Name(name).Do().Error()
return
}
// Watch returns a watch.Interface that watches the requested policyBindings
func (c *policyBindings) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().Prefix("watch").Namespace(c.ns).Resource("policyBindings").VersionedParams(&opts, kapi.ParameterCodec).Watch()
}
+44
View File
@@ -0,0 +1,44 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
projectapi "github.com/openshift/origin/pkg/project/api"
)
// ProjectRequestsInterface has methods to work with ProjectRequest resources in a namespace
type ProjectRequestsInterface interface {
ProjectRequests() ProjectRequestInterface
}
// ProjectRequestInterface exposes methods on projectRequest resources.
type ProjectRequestInterface interface {
Create(p *projectapi.ProjectRequest) (*projectapi.Project, error)
List(opts kapi.ListOptions) (*unversioned.Status, error)
}
type projectRequests struct {
r *Client
}
// newUsers returns a users
func newProjectRequests(c *Client) *projectRequests {
return &projectRequests{
r: c,
}
}
// Create creates a new Project
func (c *projectRequests) Create(p *projectapi.ProjectRequest) (result *projectapi.Project, err error) {
result = &projectapi.Project{}
err = c.r.Post().Resource("projectRequests").Body(p).Do().Into(result)
return
}
// List returns a status object indicating that a user can call the Create or an error indicating why not
func (c *projectRequests) List(opts kapi.ListOptions) (result *unversioned.Status, err error) {
result = &unversioned.Status{}
err = c.r.Get().Resource("projectRequests").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return result, err
}
+81
View File
@@ -0,0 +1,81 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
projectapi "github.com/openshift/origin/pkg/project/api"
)
// ProjectsInterface has methods to work with Project resources in a namespace
type ProjectsInterface interface {
Projects() ProjectInterface
}
// ProjectInterface exposes methods on project resources.
type ProjectInterface interface {
Create(p *projectapi.Project) (*projectapi.Project, error)
Update(p *projectapi.Project) (*projectapi.Project, error)
Delete(name string) error
Get(name string) (*projectapi.Project, error)
List(opts kapi.ListOptions) (*projectapi.ProjectList, error)
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
type projects struct {
r *Client
}
// newUsers returns a project
func newProjects(c *Client) *projects {
return &projects{
r: c,
}
}
// Get returns information about a particular project or an error
func (c *projects) Get(name string) (result *projectapi.Project, err error) {
result = &projectapi.Project{}
err = c.r.Get().Resource("projects").Name(name).Do().Into(result)
return
}
// List returns all projects matching the label selector
func (c *projects) List(opts kapi.ListOptions) (result *projectapi.ProjectList, err error) {
result = &projectapi.ProjectList{}
err = c.r.Get().
Resource("projects").
VersionedParams(&opts, kapi.ParameterCodec).
Do().
Into(result)
return
}
// Create creates a new Project
func (c *projects) Create(p *projectapi.Project) (result *projectapi.Project, err error) {
result = &projectapi.Project{}
err = c.r.Post().Resource("projects").Body(p).Do().Into(result)
return
}
// Update updates the project on server
func (c *projects) Update(p *projectapi.Project) (result *projectapi.Project, err error) {
result = &projectapi.Project{}
err = c.r.Put().Resource("projects").Name(p.Name).Body(p).Do().Into(result)
return
}
// Delete removes the project on server
func (c *projects) Delete(name string) (err error) {
err = c.r.Delete().Resource("projects").Name(name).Do().Error()
return
}
// Watch returns a watch.Interface that watches the requested namespaces.
func (c *projects) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Resource("projects").
VersionedParams(&opts, kapi.ParameterCodec).
Watch()
}
+61
View File
@@ -0,0 +1,61 @@
package client
import (
kapierrors "k8s.io/kubernetes/pkg/api/errors"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
// ResourceAccessReviews has methods to work with ResourceAccessReview resources in the cluster scope
type ResourceAccessReviews interface {
ResourceAccessReviews() ResourceAccessReviewInterface
}
// ResourceAccessReviewInterface exposes methods on ResourceAccessReview resources.
type ResourceAccessReviewInterface interface {
Create(policy *authorizationapi.ResourceAccessReview) (*authorizationapi.ResourceAccessReviewResponse, error)
}
// resourceAccessReviews implements ResourceAccessReviews interface
type resourceAccessReviews struct {
r *Client
}
// newResourceAccessReviews returns a resourceAccessReviews
func newResourceAccessReviews(c *Client) *resourceAccessReviews {
return &resourceAccessReviews{
r: c,
}
}
func (c *resourceAccessReviews) Create(rar *authorizationapi.ResourceAccessReview) (result *authorizationapi.ResourceAccessReviewResponse, err error) {
result = &authorizationapi.ResourceAccessReviewResponse{}
// if this a cluster RAR, then no special handling
if len(rar.Action.Namespace) == 0 {
err = c.r.Post().Resource("resourceAccessReviews").Body(rar).Do().Into(result)
return
}
err = c.r.Post().Resource("resourceAccessReviews").Body(rar).Do().Into(result)
// if the namespace values don't match then we definitely hit an old server. If we got a forbidden, then we might have hit an old server
// and should try the old endpoint
if (rar.Action.Namespace != result.Namespace) || kapierrors.IsForbidden(err) {
deprecatedResponse := &authorizationapi.ResourceAccessReviewResponse{}
deprecatedAttemptErr := c.r.Post().Namespace(rar.Action.Namespace).Resource("resourceAccessReviews").Body(rar).Do().Into(deprecatedResponse)
// if we definitely hit an old server, then return the error and result you get from the older server.
if rar.Action.Namespace != result.Namespace {
return deprecatedResponse, deprecatedAttemptErr
}
// if we're not certain it was an old server, success overwrites the previous error, but failure doesn't overwrite the previous error
if deprecatedAttemptErr == nil {
err = nil
result = deprecatedResponse
}
}
return
}
+69
View File
@@ -0,0 +1,69 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
// RoleBindingsNamespacer has methods to work with RoleBinding resources in a namespace
type RoleBindingsNamespacer interface {
RoleBindings(namespace string) RoleBindingInterface
}
// RoleBindingInterface exposes methods on RoleBinding resources.
type RoleBindingInterface interface {
List(opts kapi.ListOptions) (*authorizationapi.RoleBindingList, error)
Get(name string) (*authorizationapi.RoleBinding, error)
Create(roleBinding *authorizationapi.RoleBinding) (*authorizationapi.RoleBinding, error)
Update(roleBinding *authorizationapi.RoleBinding) (*authorizationapi.RoleBinding, error)
Delete(name string) error
}
// roleBindings implements RoleBindingsNamespacer interface
type roleBindings struct {
r *Client
ns string
}
// newRoleBindings returns a roleBindings
func newRoleBindings(c *Client, namespace string) *roleBindings {
return &roleBindings{
r: c,
ns: namespace,
}
}
// List returns a list of roleBindings that match the label and field selectors.
func (c *roleBindings) List(opts kapi.ListOptions) (result *authorizationapi.RoleBindingList, err error) {
result = &authorizationapi.RoleBindingList{}
err = c.r.Get().Namespace(c.ns).Resource("roleBindings").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular roleBinding and error if one occurs.
func (c *roleBindings) Get(name string) (result *authorizationapi.RoleBinding, err error) {
result = &authorizationapi.RoleBinding{}
err = c.r.Get().Namespace(c.ns).Resource("roleBindings").Name(name).Do().Into(result)
return
}
// Create creates new roleBinding. Returns the server's representation of the roleBinding and error if one occurs.
func (c *roleBindings) Create(roleBinding *authorizationapi.RoleBinding) (result *authorizationapi.RoleBinding, err error) {
result = &authorizationapi.RoleBinding{}
err = c.r.Post().Namespace(c.ns).Resource("roleBindings").Body(roleBinding).Do().Into(result)
return
}
// Update updates the roleBinding on server. Returns the server's representation of the roleBinding and error if one occurs.
func (c *roleBindings) Update(roleBinding *authorizationapi.RoleBinding) (result *authorizationapi.RoleBinding, err error) {
result = &authorizationapi.RoleBinding{}
err = c.r.Put().Namespace(c.ns).Resource("roleBindings").Name(roleBinding.Name).Body(roleBinding).Do().Into(result)
return
}
// Delete deletes a roleBinding, returns error if one occurs.
func (c *roleBindings) Delete(name string) (err error) {
err = c.r.Delete().Namespace(c.ns).Resource("roleBindings").Name(name).Do().Error()
return
}
+69
View File
@@ -0,0 +1,69 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
// RolesNamespacer has methods to work with Role resources in a namespace
type RolesNamespacer interface {
Roles(namespace string) RoleInterface
}
// RoleInterface exposes methods on Role resources.
type RoleInterface interface {
List(opts kapi.ListOptions) (*authorizationapi.RoleList, error)
Get(name string) (*authorizationapi.Role, error)
Create(role *authorizationapi.Role) (*authorizationapi.Role, error)
Update(role *authorizationapi.Role) (*authorizationapi.Role, error)
Delete(name string) error
}
// roles implements RolesNamespacer interface
type roles struct {
r *Client
ns string
}
// newRoles returns a roles
func newRoles(c *Client, namespace string) *roles {
return &roles{
r: c,
ns: namespace,
}
}
// List returns a list of roles that match the label and field selectors.
func (c *roles) List(opts kapi.ListOptions) (result *authorizationapi.RoleList, err error) {
result = &authorizationapi.RoleList{}
err = c.r.Get().Namespace(c.ns).Resource("roles").VersionedParams(&opts, kapi.ParameterCodec).Do().Into(result)
return
}
// Get returns information about a particular role and error if one occurs.
func (c *roles) Get(name string) (result *authorizationapi.Role, err error) {
result = &authorizationapi.Role{}
err = c.r.Get().Namespace(c.ns).Resource("roles").Name(name).Do().Into(result)
return
}
// Create creates new role. Returns the server's representation of the role and error if one occurs.
func (c *roles) Create(role *authorizationapi.Role) (result *authorizationapi.Role, err error) {
result = &authorizationapi.Role{}
err = c.r.Post().Namespace(c.ns).Resource("roles").Body(role).Do().Into(result)
return
}
// Update updates the role on server. Returns the server's representation of the role and error if one occurs.
func (c *roles) Update(role *authorizationapi.Role) (result *authorizationapi.Role, err error) {
result = &authorizationapi.Role{}
err = c.r.Put().Namespace(c.ns).Resource("roles").Name(role.Name).Body(role).Do().Into(result)
return
}
// Delete deletes a role, returns error if one occurs.
func (c *roles) Delete(name string) (err error) {
err = c.r.Delete().Namespace(c.ns).Resource("roles").Name(name).Do().Error()
return
}
+93
View File
@@ -0,0 +1,93 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
routeapi "github.com/openshift/origin/pkg/route/api"
)
// RoutesNamespacer has methods to work with Route resources in a namespace
type RoutesNamespacer interface {
Routes(namespace string) RouteInterface
}
// RouteInterface exposes methods on Route resources
type RouteInterface interface {
List(opts kapi.ListOptions) (*routeapi.RouteList, error)
Get(name string) (*routeapi.Route, error)
Create(route *routeapi.Route) (*routeapi.Route, error)
Update(route *routeapi.Route) (*routeapi.Route, error)
UpdateStatus(route *routeapi.Route) (*routeapi.Route, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
// routes implements RouteInterface interface
type routes struct {
r *Client
ns string
}
// newRoutes returns a routes
func newRoutes(c *Client, namespace string) *routes {
return &routes{
r: c,
ns: namespace,
}
}
// List takes a label and field selector, and returns the list of routes that match that selectors
func (c *routes) List(opts kapi.ListOptions) (result *routeapi.RouteList, err error) {
result = &routeapi.RouteList{}
err = c.r.Get().
Namespace(c.ns).
Resource("routes").
VersionedParams(&opts, kapi.ParameterCodec).
Do().
Into(result)
return
}
// Get takes the name of the route, and returns the corresponding Route object, and an error if it occurs
func (c *routes) Get(name string) (result *routeapi.Route, err error) {
result = &routeapi.Route{}
err = c.r.Get().Namespace(c.ns).Resource("routes").Name(name).Do().Into(result)
return
}
// Delete takes the name of the route, and returns an error if one occurs
func (c *routes) Delete(name string) error {
return c.r.Delete().Namespace(c.ns).Resource("routes").Name(name).Do().Error()
}
// Create takes the representation of a route. Returns the server's representation of the route, and an error, if it occurs
func (c *routes) Create(route *routeapi.Route) (result *routeapi.Route, err error) {
result = &routeapi.Route{}
err = c.r.Post().Namespace(c.ns).Resource("routes").Body(route).Do().Into(result)
return
}
// Update takes the representation of a route to update. Returns the server's representation of the route, and an error, if it occurs
func (c *routes) Update(route *routeapi.Route) (result *routeapi.Route, err error) {
result = &routeapi.Route{}
err = c.r.Put().Namespace(c.ns).Resource("routes").Name(route.Name).Body(route).Do().Into(result)
return
}
// UpdateStatus takes the route with altered status. Returns the server's representation of the route, and an error, if it occurs.
func (c *routes) UpdateStatus(route *routeapi.Route) (result *routeapi.Route, err error) {
result = &routeapi.Route{}
err = c.r.Put().Namespace(c.ns).Resource("routes").Name(route.Name).SubResource("status").Body(route).Do().Into(result)
return
}
// Watch returns a watch.Interface that watches the requested routes.
func (c *routes) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("routes").
VersionedParams(&opts, kapi.ParameterCodec).
Watch()
}
+63
View File
@@ -0,0 +1,63 @@
package client
import (
"fmt"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/apis/extensions"
unversioned_extensions "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned"
kclient "k8s.io/kubernetes/pkg/client/unversioned"
"github.com/openshift/origin/pkg/api/latest"
)
type delegatingScaleInterface struct {
dcs DeploymentConfigInterface
scales kclient.ScaleInterface
}
type delegatingScaleNamespacer struct {
dcNS DeploymentConfigsNamespacer
scaleNS kclient.ScaleNamespacer
}
func (c *delegatingScaleNamespacer) Scales(namespace string) unversioned_extensions.ScaleInterface {
return &delegatingScaleInterface{
dcs: c.dcNS.DeploymentConfigs(namespace),
scales: c.scaleNS.Scales(namespace),
}
}
func NewDelegatingScaleNamespacer(dcNamespacer DeploymentConfigsNamespacer, sNamespacer kclient.ScaleNamespacer) unversioned_extensions.ScalesGetter {
return &delegatingScaleNamespacer{
dcNS: dcNamespacer,
scaleNS: sNamespacer,
}
}
// Get takes the reference to scale subresource and returns the subresource or error, if one occurs.
func (c *delegatingScaleInterface) Get(kind string, name string) (result *extensions.Scale, err error) {
switch {
case kind == "DeploymentConfig":
return c.dcs.GetScale(name)
// TODO: This is borked because the interface for Get is broken. Kind is insufficient.
case latest.IsKindInAnyOriginGroup(kind):
return nil, errors.NewBadRequest(fmt.Sprintf("Kind %s has no Scale subresource", kind))
default:
return c.scales.Get(kind, name)
}
}
// Update takes a scale subresource object, updates the stored version to match it, and
// returns the subresource or error, if one occurs.
func (c *delegatingScaleInterface) Update(kind string, scale *extensions.Scale) (result *extensions.Scale, err error) {
switch {
case kind == "DeploymentConfig":
return c.dcs.UpdateScale(scale)
// TODO: This is borked because the interface for Update is broken. Kind is insufficient.
case latest.IsKindInAnyOriginGroup(kind):
return nil, errors.NewBadRequest(fmt.Sprintf("Kind %s has no Scale subresource", kind))
default:
return c.scales.Update(kind, scale)
}
}
@@ -0,0 +1,32 @@
package client
import (
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
type SelfSubjectRulesReviewsNamespacer interface {
SelfSubjectRulesReviews(namespace string) SelfSubjectRulesReviewInterface
}
type SelfSubjectRulesReviewInterface interface {
Create(*authorizationapi.SelfSubjectRulesReview) (*authorizationapi.SelfSubjectRulesReview, error)
}
type selfSubjectRulesReviews struct {
r *Client
ns string
}
func newSelfSubjectRulesReviews(c *Client, namespace string) *selfSubjectRulesReviews {
return &selfSubjectRulesReviews{
r: c,
ns: namespace,
}
}
func (c *selfSubjectRulesReviews) Create(selfSubjectRulesReview *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
result = &authorizationapi.SelfSubjectRulesReview{}
err = c.r.Post().Namespace(c.ns).Resource("selfSubjectRulesReviews").Body(selfSubjectRulesReview).Do().Into(result)
return
}
+100
View File
@@ -0,0 +1,100 @@
package client
import (
"errors"
"fmt"
kapierrors "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/client/restclient"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
type SubjectAccessReviewsImpersonator interface {
ImpersonateSubjectAccessReviews(token string) SubjectAccessReviewInterface
}
// SubjectAccessReviews has methods to work with SubjectAccessReview resources in the cluster scope
type SubjectAccessReviews interface {
SubjectAccessReviews() SubjectAccessReviewInterface
}
// SubjectAccessReviewInterface exposes methods on SubjectAccessReview resources.
type SubjectAccessReviewInterface interface {
Create(policy *authorizationapi.SubjectAccessReview) (*authorizationapi.SubjectAccessReviewResponse, error)
}
// subjectAccessReviews implements SubjectAccessReviews interface
type subjectAccessReviews struct {
r *Client
token *string
}
// newImpersonatingSubjectAccessReviews returns a subjectAccessReviews
func newImpersonatingSubjectAccessReviews(c *Client, token string) *subjectAccessReviews {
return &subjectAccessReviews{
r: c,
token: &token,
}
}
// newSubjectAccessReviews returns a subjectAccessReviews
func newSubjectAccessReviews(c *Client) *subjectAccessReviews {
return &subjectAccessReviews{
r: c,
}
}
func (c *subjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (*authorizationapi.SubjectAccessReviewResponse, error) {
result := &authorizationapi.SubjectAccessReviewResponse{}
// if this a cluster SAR, then no special handling
if len(sar.Action.Namespace) == 0 {
req, err := overrideAuth(c.token, c.r.Post().Resource("subjectAccessReviews"))
if err != nil {
return &authorizationapi.SubjectAccessReviewResponse{}, err
}
err = req.Body(sar).Do().Into(result)
return result, err
}
err := c.r.Post().Resource("subjectAccessReviews").Body(sar).Do().Into(result)
// if the namespace values don't match then we definitely hit an old server. If we got a forbidden, then we might have hit an old server
// and should try the old endpoint
if (sar.Action.Namespace != result.Namespace) || kapierrors.IsForbidden(err) {
deprecatedReq, deprecatedAttemptErr := overrideAuth(c.token, c.r.Post().Namespace(sar.Action.Namespace).Resource("subjectAccessReviews"))
if deprecatedAttemptErr != nil {
return &authorizationapi.SubjectAccessReviewResponse{}, deprecatedAttemptErr
}
deprecatedResponse := &authorizationapi.SubjectAccessReviewResponse{}
deprecatedAttemptErr = deprecatedReq.Body(sar).Do().Into(deprecatedResponse)
// if we definitely hit an old server, then return the error and result you get from the older server.
if sar.Action.Namespace != result.Namespace {
return deprecatedResponse, deprecatedAttemptErr
}
// if we're not certain it was an old server, success overwrites the previous error, but failure doesn't overwrite the previous error
if deprecatedAttemptErr == nil {
err = nil
result = deprecatedResponse
}
}
return result, err
}
// overrideAuth specifies the token to authenticate the request with. token == "" is not allowed
func overrideAuth(token *string, req *restclient.Request) (*restclient.Request, error) {
if token != nil {
if len(*token) == 0 {
return nil, errors.New("impersonating token may not be empty")
}
req.SetHeader("Authorization", fmt.Sprintf("Bearer %s", *token))
}
return req, nil
}
+37
View File
@@ -0,0 +1,37 @@
package client
import (
templateapi "github.com/openshift/origin/pkg/template/api"
)
// TemplateConfigNamespacer has methods to work with Image resources in a namespace
// TODO: Rename to ProcessedTemplates
type TemplateConfigsNamespacer interface {
TemplateConfigs(namespace string) TemplateConfigInterface
}
// TemplateConfigInterface exposes methods on Image resources.
type TemplateConfigInterface interface {
Create(t *templateapi.Template) (*templateapi.Template, error)
}
// templateConfigs implements TemplateConfigsNamespacer interface
type templateConfigs struct {
r *Client
ns string
}
// newTemplateConfigs returns an TemplateConfigInterface
func newTemplateConfigs(c *Client, namespace string) TemplateConfigInterface {
return &templateConfigs{
r: c,
ns: namespace,
}
}
// Create process the Template and returns its current state
func (c *templateConfigs) Create(in *templateapi.Template) (*templateapi.Template, error) {
template := &templateapi.Template{}
err := c.r.Post().Namespace(c.ns).Resource("processedTemplates").Body(in).Do().Into(template)
return template, err
}
+86
View File
@@ -0,0 +1,86 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
templateapi "github.com/openshift/origin/pkg/template/api"
)
// TemplatesNamespacer has methods to work with Template resources in a namespace
type TemplatesNamespacer interface {
Templates(namespace string) TemplateInterface
}
// TemplateInterface exposes methods on Template resources.
type TemplateInterface interface {
List(opts kapi.ListOptions) (*templateapi.TemplateList, error)
Get(name string) (*templateapi.Template, error)
Create(template *templateapi.Template) (*templateapi.Template, error)
Update(template *templateapi.Template) (*templateapi.Template, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
// templates implements TemplatesNamespacer interface
type templates struct {
r *Client
ns string
}
// newTemplates returns a templates
func newTemplates(c *Client, namespace string) *templates {
return &templates{
r: c,
ns: namespace,
}
}
// List returns a list of templates that match the label and field selectors.
func (c *templates) List(opts kapi.ListOptions) (result *templateapi.TemplateList, err error) {
result = &templateapi.TemplateList{}
err = c.r.Get().
Namespace(c.ns).
Resource("templates").
VersionedParams(&opts, kapi.ParameterCodec).
Do().
Into(result)
return
}
// Get returns information about a particular template and error if one occurs.
func (c *templates) Get(name string) (result *templateapi.Template, err error) {
result = &templateapi.Template{}
err = c.r.Get().Namespace(c.ns).Resource("templates").Name(name).Do().Into(result)
return
}
// Create creates new template. Returns the server's representation of the template and error if one occurs.
func (c *templates) Create(template *templateapi.Template) (result *templateapi.Template, err error) {
result = &templateapi.Template{}
err = c.r.Post().Namespace(c.ns).Resource("templates").Body(template).Do().Into(result)
return
}
// Update updates the template on server. Returns the server's representation of the template and error if one occurs.
func (c *templates) Update(template *templateapi.Template) (result *templateapi.Template, err error) {
result = &templateapi.Template{}
err = c.r.Put().Namespace(c.ns).Resource("templates").Name(template.Name).Body(template).Do().Into(result)
return
}
// Delete deletes a template, returns error if one occurs.
func (c *templates) Delete(name string) (err error) {
err = c.r.Delete().Namespace(c.ns).Resource("templates").Name(name).Do().Error()
return
}
// Watch returns a watch.Interface that watches the requested templates
func (c *templates) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("templates").
VersionedParams(&opts, kapi.ParameterCodec).
Watch()
}
+57
View File
@@ -0,0 +1,57 @@
package client
import (
userapi "github.com/openshift/origin/pkg/user/api"
)
// UserIdentityMappingsInterface has methods to work with UserIdentityMapping resources in a namespace
type UserIdentityMappingsInterface interface {
UserIdentityMappings() UserIdentityMappingInterface
}
// UserIdentityMappingInterface exposes methods on UserIdentityMapping resources.
type UserIdentityMappingInterface interface {
Get(string) (*userapi.UserIdentityMapping, error)
Create(*userapi.UserIdentityMapping) (*userapi.UserIdentityMapping, error)
Update(*userapi.UserIdentityMapping) (*userapi.UserIdentityMapping, error)
Delete(string) error
}
// userIdentityMappings implements UserIdentityMappingsNamespacer interface
type userIdentityMappings struct {
r *Client
}
// newUserIdentityMappings returns a userIdentityMappings
func newUserIdentityMappings(c *Client) *userIdentityMappings {
return &userIdentityMappings{
r: c,
}
}
// Get returns information about a particular mapping or an error
func (c *userIdentityMappings) Get(name string) (result *userapi.UserIdentityMapping, err error) {
result = &userapi.UserIdentityMapping{}
err = c.r.Get().Resource("userIdentityMappings").Name(name).Do().Into(result)
return
}
// Create creates a new mapping. Returns the server's representation of the mapping and error if one occurs.
func (c *userIdentityMappings) Create(mapping *userapi.UserIdentityMapping) (result *userapi.UserIdentityMapping, err error) {
result = &userapi.UserIdentityMapping{}
err = c.r.Post().Resource("userIdentityMappings").Body(mapping).Do().Into(result)
return
}
// Update updates the mapping on server. Returns the server's representation of the mapping and error if one occurs.
func (c *userIdentityMappings) Update(mapping *userapi.UserIdentityMapping) (result *userapi.UserIdentityMapping, err error) {
result = &userapi.UserIdentityMapping{}
err = c.r.Put().Resource("userIdentityMappings").Name(mapping.Name).Body(mapping).Do().Into(result)
return
}
// Delete deletes the mapping on server.
func (c *userIdentityMappings) Delete(name string) (err error) {
err = c.r.Delete().Resource("userIdentityMappings").Name(name).Do().Error()
return
}
+81
View File
@@ -0,0 +1,81 @@
package client
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/watch"
userapi "github.com/openshift/origin/pkg/user/api"
)
// UsersInterface has methods to work with User resources
type UsersInterface interface {
Users() UserInterface
}
// UserInterface exposes methods on user resources.
type UserInterface interface {
List(opts kapi.ListOptions) (*userapi.UserList, error)
Get(name string) (*userapi.User, error)
Create(user *userapi.User) (*userapi.User, error)
Update(user *userapi.User) (*userapi.User, error)
Delete(name string) error
Watch(opts kapi.ListOptions) (watch.Interface, error)
}
// users implements UserInterface interface
type users struct {
r *Client
}
// newUsers returns a users
func newUsers(c *Client) *users {
return &users{
r: c,
}
}
// List returns a list of users that match the label and field selectors.
func (c *users) List(opts kapi.ListOptions) (result *userapi.UserList, err error) {
result = &userapi.UserList{}
err = c.r.Get().
Resource("users").
VersionedParams(&opts, kapi.ParameterCodec).
Do().
Into(result)
return
}
// Get returns information about a particular user or an error
func (c *users) Get(name string) (result *userapi.User, err error) {
result = &userapi.User{}
err = c.r.Get().Resource("users").Name(name).Do().Into(result)
return
}
// Create creates a new user. Returns the server's representation of the user and error if one occurs.
func (c *users) Create(user *userapi.User) (result *userapi.User, err error) {
result = &userapi.User{}
err = c.r.Post().Resource("users").Body(user).Do().Into(result)
return
}
// Update updates the user on server. Returns the server's representation of the user and error if one occurs.
func (c *users) Update(user *userapi.User) (result *userapi.User, err error) {
result = &userapi.User{}
err = c.r.Put().Resource("users").Name(user.Name).Body(user).Do().Into(result)
return
}
// Delete deletes the user on server. Returns an error if one occurs.
func (c *users) Delete(name string) (err error) {
return c.r.Delete().Resource("users").Name(name).Do().Error()
}
// Watch returns a watch.Interface that watches the requested users.
func (c *users) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Resource("users").
VersionedParams(&opts, kapi.ParameterCodec).
Watch()
}