From f71dcc20cc10b41916c586ce9f47596a576b457e Mon Sep 17 00:00:00 2001 From: David Eads Date: Fri, 27 Oct 2017 13:46:52 -0400 Subject: [PATCH] codegen --- apps/clientset/versioned/clientset.go | 82 +++++++ apps/clientset/versioned/doc.go | 4 + .../versioned/fake/clientset_generated.go | 55 +++++ apps/clientset/versioned/fake/doc.go | 4 + apps/clientset/versioned/fake/register.go | 37 +++ apps/clientset/versioned/scheme/doc.go | 4 + apps/clientset/versioned/scheme/register.go | 37 +++ .../versioned/typed/apps/v1/apps_client.go | 72 ++++++ .../typed/apps/v1/deploymentconfig.go | 218 ++++++++++++++++++ apps/clientset/versioned/typed/apps/v1/doc.go | 4 + .../versioned/typed/apps/v1/fake/doc.go | 4 + .../typed/apps/v1/fake/fake_apps_client.go | 22 ++ .../apps/v1/fake/fake_deploymentconfig.go | 167 ++++++++++++++ .../typed/apps/v1/generated_expansion.go | 3 + .../externalversions/apps/interface.go | 28 +++ .../apps/v1/deploymentconfig.go | 57 +++++ .../externalversions/apps/v1/interface.go | 27 +++ apps/informers/externalversions/factory.go | 102 ++++++++ apps/informers/externalversions/generic.go | 45 ++++ .../internalinterfaces/factory_interfaces.go | 18 ++ apps/listers/apps/v1/deploymentconfig.go | 78 +++++++ apps/listers/apps/v1/expansion_generated.go | 11 + .../clientset/versioned/clientset.go | 82 +++++++ authorization/clientset/versioned/doc.go | 4 + .../versioned/fake/clientset_generated.go | 55 +++++ authorization/clientset/versioned/fake/doc.go | 4 + .../clientset/versioned/fake/register.go | 37 +++ .../clientset/versioned/scheme/doc.go | 4 + .../clientset/versioned/scheme/register.go | 37 +++ .../authorization/v1/authorization_client.go | 142 ++++++++++++ .../typed/authorization/v1/clusterpolicy.go | 129 +++++++++++ .../authorization/v1/clusterpolicybinding.go | 129 +++++++++++ .../typed/authorization/v1/clusterrole.go | 129 +++++++++++ .../authorization/v1/clusterrolebinding.go | 129 +++++++++++ .../versioned/typed/authorization/v1/doc.go | 4 + .../typed/authorization/v1/fake/doc.go | 4 + .../v1/fake/fake_authorization_client.go | 78 +++++++ .../v1/fake/fake_clusterpolicy.go | 102 ++++++++ .../v1/fake/fake_clusterpolicybinding.go | 102 ++++++++ .../authorization/v1/fake/fake_clusterrole.go | 102 ++++++++ .../v1/fake/fake_clusterrolebinding.go | 102 ++++++++ .../v1/fake/fake_localresourceaccessreview.go | 28 +++ .../v1/fake/fake_localsubjectaccessreview.go | 28 +++ .../authorization/v1/fake/fake_policy.go | 110 +++++++++ .../v1/fake/fake_policybinding.go | 110 +++++++++ .../v1/fake/fake_resourceaccessreview.go | 26 +++ .../typed/authorization/v1/fake/fake_role.go | 110 +++++++++ .../authorization/v1/fake/fake_rolebinding.go | 110 +++++++++ .../v1/fake/fake_rolebindingrestriction.go | 110 +++++++++ .../v1/fake/fake_selfsubjectrulesreview.go | 28 +++ .../v1/fake/fake_subjectaccessreview.go | 26 +++ .../v1/fake/fake_subjectrulesreview.go | 28 +++ .../authorization/v1/generated_expansion.go | 31 +++ .../v1/localresourceaccessreview.go | 45 ++++ .../v1/localsubjectaccessreview.go | 45 ++++ .../typed/authorization/v1/policy.go | 139 +++++++++++ .../typed/authorization/v1/policybinding.go | 139 +++++++++++ .../authorization/v1/resourceaccessreview.go | 42 ++++ .../versioned/typed/authorization/v1/role.go | 139 +++++++++++ .../typed/authorization/v1/rolebinding.go | 139 +++++++++++ .../v1/rolebindingrestriction.go | 139 +++++++++++ .../v1/selfsubjectrulesreview.go | 44 ++++ .../authorization/v1/subjectaccessreview.go | 42 ++++ .../authorization/v1/subjectrulesreview.go | 44 ++++ .../authorization/interface.go | 28 +++ .../authorization/v1/clusterpolicy.go | 57 +++++ .../authorization/v1/clusterpolicybinding.go | 57 +++++ .../authorization/v1/clusterrole.go | 57 +++++ .../authorization/v1/clusterrolebinding.go | 57 +++++ .../authorization/v1/interface.go | 83 +++++++ .../authorization/v1/policy.go | 57 +++++ .../authorization/v1/policybinding.go | 57 +++++ .../externalversions/authorization/v1/role.go | 57 +++++ .../authorization/v1/rolebinding.go | 57 +++++ .../v1/rolebindingrestriction.go | 57 +++++ .../informers/externalversions/factory.go | 102 ++++++++ .../informers/externalversions/generic.go | 61 +++++ .../internalinterfaces/factory_interfaces.go | 18 ++ .../listers/authorization/v1/clusterpolicy.go | 51 ++++ .../authorization/v1/clusterpolicybinding.go | 51 ++++ .../listers/authorization/v1/clusterrole.go | 51 ++++ .../authorization/v1/clusterrolebinding.go | 51 ++++ .../authorization/v1/expansion_generated.go | 59 +++++ .../listers/authorization/v1/policy.go | 78 +++++++ .../listers/authorization/v1/policybinding.go | 78 +++++++ .../listers/authorization/v1/role.go | 78 +++++++ .../listers/authorization/v1/rolebinding.go | 78 +++++++ .../v1/rolebindingrestriction.go | 78 +++++++ build/clientset/versioned/clientset.go | 82 +++++++ build/clientset/versioned/doc.go | 4 + .../versioned/fake/clientset_generated.go | 55 +++++ build/clientset/versioned/fake/doc.go | 4 + build/clientset/versioned/fake/register.go | 37 +++ build/clientset/versioned/scheme/doc.go | 4 + build/clientset/versioned/scheme/register.go | 37 +++ .../versioned/typed/build/v1/build.go | 187 +++++++++++++++ .../versioned/typed/build/v1/build_client.go | 77 +++++++ .../versioned/typed/build/v1/buildconfig.go | 172 ++++++++++++++ .../clientset/versioned/typed/build/v1/doc.go | 4 + .../versioned/typed/build/v1/fake/doc.go | 4 + .../typed/build/v1/fake/fake_build.go | 144 ++++++++++++ .../typed/build/v1/fake/fake_build_client.go | 26 +++ .../typed/build/v1/fake/fake_buildconfig.go | 133 +++++++++++ .../typed/build/v1/generated_expansion.go | 5 + .../externalversions/build/interface.go | 28 +++ .../externalversions/build/v1/build.go | 57 +++++ .../externalversions/build/v1/buildconfig.go | 57 +++++ .../externalversions/build/v1/interface.go | 34 +++ build/informers/externalversions/factory.go | 102 ++++++++ build/informers/externalversions/generic.go | 47 ++++ .../internalinterfaces/factory_interfaces.go | 18 ++ build/listers/build/v1/build.go | 78 +++++++ build/listers/build/v1/buildconfig.go | 78 +++++++ build/listers/build/v1/expansion_generated.go | 19 ++ image/clientset/versioned/clientset.go | 82 +++++++ image/clientset/versioned/doc.go | 4 + .../versioned/fake/clientset_generated.go | 55 +++++ image/clientset/versioned/fake/doc.go | 4 + image/clientset/versioned/fake/register.go | 37 +++ image/clientset/versioned/scheme/doc.go | 4 + image/clientset/versioned/scheme/register.go | 37 +++ .../clientset/versioned/typed/image/v1/doc.go | 4 + .../versioned/typed/image/v1/fake/doc.go | 4 + .../typed/image/v1/fake/fake_image.go | 102 ++++++++ .../typed/image/v1/fake/fake_image_client.go | 46 ++++ .../image/v1/fake/fake_imagesignature.go | 34 +++ .../typed/image/v1/fake/fake_imagestream.go | 134 +++++++++++ .../image/v1/fake/fake_imagestreamimage.go | 29 +++ .../image/v1/fake/fake_imagestreamimport.go | 28 +++ .../image/v1/fake/fake_imagestreammapping.go | 29 +++ .../image/v1/fake/fake_imagestreamtag.go | 59 +++++ .../typed/image/v1/generated_expansion.go | 15 ++ .../versioned/typed/image/v1/image.go | 129 +++++++++++ .../versioned/typed/image/v1/image_client.go | 102 ++++++++ .../typed/image/v1/imagesignature.go | 53 +++++ .../versioned/typed/image/v1/imagestream.go | 173 ++++++++++++++ .../typed/image/v1/imagestreamimage.go | 47 ++++ .../typed/image/v1/imagestreamimport.go | 44 ++++ .../typed/image/v1/imagestreammapping.go | 46 ++++ .../typed/image/v1/imagestreamtag.go | 86 +++++++ image/informers/externalversions/factory.go | 102 ++++++++ image/informers/externalversions/generic.go | 47 ++++ .../externalversions/image/interface.go | 28 +++ .../externalversions/image/v1/image.go | 57 +++++ .../externalversions/image/v1/imagestream.go | 57 +++++ .../externalversions/image/v1/interface.go | 34 +++ .../internalinterfaces/factory_interfaces.go | 18 ++ image/listers/image/v1/expansion_generated.go | 15 ++ image/listers/image/v1/image.go | 51 ++++ image/listers/image/v1/imagestream.go | 78 +++++++ network/clientset/versioned/clientset.go | 82 +++++++ network/clientset/versioned/doc.go | 4 + .../versioned/fake/clientset_generated.go | 55 +++++ network/clientset/versioned/fake/doc.go | 4 + network/clientset/versioned/fake/register.go | 37 +++ network/clientset/versioned/scheme/doc.go | 4 + .../clientset/versioned/scheme/register.go | 37 +++ .../typed/network/v1/clusternetwork.go | 129 +++++++++++ .../versioned/typed/network/v1/doc.go | 4 + .../typed/network/v1/egressnetworkpolicy.go | 139 +++++++++++ .../versioned/typed/network/v1/fake/doc.go | 4 + .../network/v1/fake/fake_clusternetwork.go | 102 ++++++++ .../v1/fake/fake_egressnetworkpolicy.go | 110 +++++++++ .../typed/network/v1/fake/fake_hostsubnet.go | 102 ++++++++ .../network/v1/fake/fake_netnamespace.go | 102 ++++++++ .../network/v1/fake/fake_network_client.go | 34 +++ .../typed/network/v1/generated_expansion.go | 9 + .../versioned/typed/network/v1/hostsubnet.go | 129 +++++++++++ .../typed/network/v1/netnamespace.go | 129 +++++++++++ .../typed/network/v1/network_client.go | 87 +++++++ network/informers/externalversions/factory.go | 102 ++++++++ network/informers/externalversions/generic.go | 51 ++++ .../internalinterfaces/factory_interfaces.go | 18 ++ .../externalversions/network/interface.go | 28 +++ .../network/v1/clusternetwork.go | 57 +++++ .../network/v1/egressnetworkpolicy.go | 57 +++++ .../externalversions/network/v1/hostsubnet.go | 57 +++++ .../externalversions/network/v1/interface.go | 48 ++++ .../network/v1/netnamespace.go | 57 +++++ network/listers/network/v1/clusternetwork.go | 51 ++++ .../listers/network/v1/egressnetworkpolicy.go | 78 +++++++ .../listers/network/v1/expansion_generated.go | 23 ++ network/listers/network/v1/hostsubnet.go | 51 ++++ network/listers/network/v1/netnamespace.go | 51 ++++ oauth/clientset/versioned/clientset.go | 82 +++++++ oauth/clientset/versioned/doc.go | 4 + .../versioned/fake/clientset_generated.go | 55 +++++ oauth/clientset/versioned/fake/doc.go | 4 + oauth/clientset/versioned/fake/register.go | 37 +++ oauth/clientset/versioned/scheme/doc.go | 4 + oauth/clientset/versioned/scheme/register.go | 37 +++ .../clientset/versioned/typed/oauth/v1/doc.go | 4 + .../versioned/typed/oauth/v1/fake/doc.go | 4 + .../typed/oauth/v1/fake/fake_oauth_client.go | 34 +++ .../oauth/v1/fake/fake_oauthaccesstoken.go | 102 ++++++++ .../oauth/v1/fake/fake_oauthauthorizetoken.go | 102 ++++++++ .../typed/oauth/v1/fake/fake_oauthclient.go | 102 ++++++++ .../v1/fake/fake_oauthclientauthorization.go | 102 ++++++++ .../typed/oauth/v1/generated_expansion.go | 9 + .../versioned/typed/oauth/v1/oauth_client.go | 87 +++++++ .../typed/oauth/v1/oauthaccesstoken.go | 129 +++++++++++ .../typed/oauth/v1/oauthauthorizetoken.go | 129 +++++++++++ .../versioned/typed/oauth/v1/oauthclient.go | 129 +++++++++++ .../oauth/v1/oauthclientauthorization.go | 129 +++++++++++ oauth/informers/externalversions/factory.go | 102 ++++++++ oauth/informers/externalversions/generic.go | 51 ++++ .../internalinterfaces/factory_interfaces.go | 18 ++ .../externalversions/oauth/interface.go | 28 +++ .../externalversions/oauth/v1/interface.go | 48 ++++ .../oauth/v1/oauthaccesstoken.go | 57 +++++ .../oauth/v1/oauthauthorizetoken.go | 57 +++++ .../externalversions/oauth/v1/oauthclient.go | 57 +++++ .../oauth/v1/oauthclientauthorization.go | 57 +++++ oauth/listers/oauth/v1/expansion_generated.go | 19 ++ oauth/listers/oauth/v1/oauthaccesstoken.go | 51 ++++ oauth/listers/oauth/v1/oauthauthorizetoken.go | 51 ++++ oauth/listers/oauth/v1/oauthclient.go | 51 ++++ .../oauth/v1/oauthclientauthorization.go | 51 ++++ project/clientset/versioned/clientset.go | 82 +++++++ project/clientset/versioned/doc.go | 4 + .../versioned/fake/clientset_generated.go | 55 +++++ project/clientset/versioned/fake/doc.go | 4 + project/clientset/versioned/fake/register.go | 37 +++ project/clientset/versioned/scheme/doc.go | 4 + .../clientset/versioned/scheme/register.go | 37 +++ .../versioned/typed/project/v1/doc.go | 4 + .../versioned/typed/project/v1/fake/doc.go | 4 + .../typed/project/v1/fake/fake_project.go | 113 +++++++++ .../project/v1/fake/fake_project_client.go | 26 +++ .../project/v1/fake/fake_projectrequest.go | 26 +++ .../typed/project/v1/generated_expansion.go | 5 + .../versioned/typed/project/v1/project.go | 145 ++++++++++++ .../typed/project/v1/project_client.go | 77 +++++++ .../typed/project/v1/projectrequest.go | 42 ++++ project/informers/externalversions/factory.go | 102 ++++++++ project/informers/externalversions/generic.go | 45 ++++ .../internalinterfaces/factory_interfaces.go | 18 ++ .../externalversions/project/interface.go | 28 +++ .../externalversions/project/v1/interface.go | 27 +++ .../externalversions/project/v1/project.go | 57 +++++ .../listers/project/v1/expansion_generated.go | 7 + project/listers/project/v1/project.go | 51 ++++ quota/clientset/versioned/clientset.go | 82 +++++++ quota/clientset/versioned/doc.go | 4 + .../versioned/fake/clientset_generated.go | 55 +++++ quota/clientset/versioned/fake/doc.go | 4 + quota/clientset/versioned/fake/register.go | 37 +++ quota/clientset/versioned/scheme/doc.go | 4 + quota/clientset/versioned/scheme/register.go | 37 +++ .../quota/v1/appliedclusterresourcequota.go | 60 +++++ .../typed/quota/v1/clusterresourcequota.go | 145 ++++++++++++ .../clientset/versioned/typed/quota/v1/doc.go | 4 + .../versioned/typed/quota/v1/fake/doc.go | 4 + .../fake/fake_appliedclusterresourcequota.go | 52 +++++ .../v1/fake/fake_clusterresourcequota.go | 113 +++++++++ .../typed/quota/v1/fake/fake_quota_client.go | 26 +++ .../typed/quota/v1/generated_expansion.go | 5 + .../versioned/typed/quota/v1/quota_client.go | 77 +++++++ quota/informers/externalversions/factory.go | 102 ++++++++ quota/informers/externalversions/generic.go | 45 ++++ .../internalinterfaces/factory_interfaces.go | 18 ++ .../externalversions/quota/interface.go | 28 +++ .../quota/v1/clusterresourcequota.go | 57 +++++ .../externalversions/quota/v1/interface.go | 27 +++ .../quota/v1/appliedclusterresourcequota.go | 78 +++++++ .../listers/quota/v1/clusterresourcequota.go | 51 ++++ quota/listers/quota/v1/expansion_generated.go | 15 ++ route/clientset/versioned/clientset.go | 82 +++++++ route/clientset/versioned/doc.go | 4 + .../versioned/fake/clientset_generated.go | 55 +++++ route/clientset/versioned/fake/doc.go | 4 + route/clientset/versioned/fake/register.go | 37 +++ route/clientset/versioned/scheme/doc.go | 4 + route/clientset/versioned/scheme/register.go | 37 +++ .../clientset/versioned/typed/route/v1/doc.go | 4 + .../versioned/typed/route/v1/fake/doc.go | 4 + .../typed/route/v1/fake/fake_route.go | 122 ++++++++++ .../typed/route/v1/fake/fake_route_client.go | 22 ++ .../typed/route/v1/generated_expansion.go | 3 + .../versioned/typed/route/v1/route.go | 156 +++++++++++++ .../versioned/typed/route/v1/route_client.go | 72 ++++++ route/informers/externalversions/factory.go | 102 ++++++++ route/informers/externalversions/generic.go | 45 ++++ .../internalinterfaces/factory_interfaces.go | 18 ++ .../externalversions/route/interface.go | 28 +++ .../externalversions/route/v1/interface.go | 27 +++ .../externalversions/route/v1/route.go | 57 +++++ route/listers/route/v1/expansion_generated.go | 11 + route/listers/route/v1/route.go | 78 +++++++ security/clientset/versioned/clientset.go | 82 +++++++ security/clientset/versioned/doc.go | 4 + .../versioned/fake/clientset_generated.go | 55 +++++ security/clientset/versioned/fake/doc.go | 4 + security/clientset/versioned/fake/register.go | 37 +++ security/clientset/versioned/scheme/doc.go | 4 + .../clientset/versioned/scheme/register.go | 37 +++ .../versioned/typed/security/v1/doc.go | 4 + .../versioned/typed/security/v1/fake/doc.go | 4 + .../v1/fake/fake_podsecuritypolicyreview.go | 28 +++ ...fake_podsecuritypolicyselfsubjectreview.go | 28 +++ .../fake_podsecuritypolicysubjectreview.go | 28 +++ .../security/v1/fake/fake_security_client.go | 34 +++ .../fake/fake_securitycontextconstraints.go | 102 ++++++++ .../typed/security/v1/generated_expansion.go | 9 + .../security/v1/podsecuritypolicyreview.go | 44 ++++ .../v1/podsecuritypolicyselfsubjectreview.go | 44 ++++ .../v1/podsecuritypolicysubjectreview.go | 44 ++++ .../typed/security/v1/security_client.go | 87 +++++++ .../security/v1/securitycontextconstraints.go | 129 +++++++++++ .../informers/externalversions/factory.go | 102 ++++++++ .../informers/externalversions/generic.go | 45 ++++ .../internalinterfaces/factory_interfaces.go | 18 ++ .../externalversions/security/interface.go | 28 +++ .../externalversions/security/v1/interface.go | 27 +++ .../security/v1/securitycontextconstraints.go | 57 +++++ .../security/v1/expansion_generated.go | 7 + .../security/v1/securitycontextconstraints.go | 51 ++++ template/clientset/versioned/clientset.go | 82 +++++++ template/clientset/versioned/doc.go | 4 + .../versioned/fake/clientset_generated.go | 55 +++++ template/clientset/versioned/fake/doc.go | 4 + template/clientset/versioned/fake/register.go | 37 +++ template/clientset/versioned/scheme/doc.go | 4 + .../clientset/versioned/scheme/register.go | 37 +++ .../template/v1/brokertemplateinstance.go | 129 +++++++++++ .../versioned/typed/template/v1/doc.go | 4 + .../versioned/typed/template/v1/fake/doc.go | 4 + .../v1/fake/fake_brokertemplateinstance.go | 102 ++++++++ .../typed/template/v1/fake/fake_template.go | 110 +++++++++ .../template/v1/fake/fake_template_client.go | 30 +++ .../template/v1/fake/fake_templateinstance.go | 122 ++++++++++ .../typed/template/v1/generated_expansion.go | 7 + .../versioned/typed/template/v1/template.go | 139 +++++++++++ .../typed/template/v1/template_client.go | 82 +++++++ .../typed/template/v1/templateinstance.go | 156 +++++++++++++ .../informers/externalversions/factory.go | 102 ++++++++ .../informers/externalversions/generic.go | 49 ++++ .../internalinterfaces/factory_interfaces.go | 18 ++ .../externalversions/template/interface.go | 28 +++ .../template/v1/brokertemplateinstance.go | 57 +++++ .../externalversions/template/v1/interface.go | 41 ++++ .../externalversions/template/v1/template.go | 57 +++++ .../template/v1/templateinstance.go | 57 +++++ .../template/v1/brokertemplateinstance.go | 51 ++++ .../template/v1/expansion_generated.go | 23 ++ template/listers/template/v1/template.go | 78 +++++++ .../listers/template/v1/templateinstance.go | 78 +++++++ user/clientset/versioned/clientset.go | 82 +++++++ user/clientset/versioned/doc.go | 4 + .../versioned/fake/clientset_generated.go | 55 +++++ user/clientset/versioned/fake/doc.go | 4 + user/clientset/versioned/fake/register.go | 37 +++ user/clientset/versioned/scheme/doc.go | 4 + user/clientset/versioned/scheme/register.go | 37 +++ user/clientset/versioned/typed/user/v1/doc.go | 4 + .../versioned/typed/user/v1/fake/doc.go | 4 + .../typed/user/v1/fake/fake_group.go | 102 ++++++++ .../typed/user/v1/fake/fake_identity.go | 102 ++++++++ .../versioned/typed/user/v1/fake/fake_user.go | 102 ++++++++ .../typed/user/v1/fake/fake_user_client.go | 34 +++ .../user/v1/fake/fake_useridentitymapping.go | 54 +++++ .../typed/user/v1/generated_expansion.go | 9 + .../versioned/typed/user/v1/group.go | 129 +++++++++++ .../versioned/typed/user/v1/identity.go | 129 +++++++++++ .../clientset/versioned/typed/user/v1/user.go | 129 +++++++++++ .../versioned/typed/user/v1/user_client.go | 87 +++++++ .../typed/user/v1/useridentitymapping.go | 80 +++++++ user/informers/externalversions/factory.go | 102 ++++++++ user/informers/externalversions/generic.go | 49 ++++ .../internalinterfaces/factory_interfaces.go | 18 ++ .../externalversions/user/interface.go | 28 +++ .../externalversions/user/v1/group.go | 57 +++++ .../externalversions/user/v1/identity.go | 57 +++++ .../externalversions/user/v1/interface.go | 41 ++++ .../externalversions/user/v1/user.go | 57 +++++ user/listers/user/v1/expansion_generated.go | 15 ++ user/listers/user/v1/group.go | 51 ++++ user/listers/user/v1/identity.go | 51 ++++ user/listers/user/v1/user.go | 51 ++++ 379 files changed, 20753 insertions(+) create mode 100644 apps/clientset/versioned/clientset.go create mode 100644 apps/clientset/versioned/doc.go create mode 100644 apps/clientset/versioned/fake/clientset_generated.go create mode 100644 apps/clientset/versioned/fake/doc.go create mode 100644 apps/clientset/versioned/fake/register.go create mode 100644 apps/clientset/versioned/scheme/doc.go create mode 100644 apps/clientset/versioned/scheme/register.go create mode 100644 apps/clientset/versioned/typed/apps/v1/apps_client.go create mode 100644 apps/clientset/versioned/typed/apps/v1/deploymentconfig.go create mode 100644 apps/clientset/versioned/typed/apps/v1/doc.go create mode 100644 apps/clientset/versioned/typed/apps/v1/fake/doc.go create mode 100644 apps/clientset/versioned/typed/apps/v1/fake/fake_apps_client.go create mode 100644 apps/clientset/versioned/typed/apps/v1/fake/fake_deploymentconfig.go create mode 100644 apps/clientset/versioned/typed/apps/v1/generated_expansion.go create mode 100644 apps/informers/externalversions/apps/interface.go create mode 100644 apps/informers/externalversions/apps/v1/deploymentconfig.go create mode 100644 apps/informers/externalversions/apps/v1/interface.go create mode 100644 apps/informers/externalversions/factory.go create mode 100644 apps/informers/externalversions/generic.go create mode 100644 apps/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 apps/listers/apps/v1/deploymentconfig.go create mode 100644 apps/listers/apps/v1/expansion_generated.go create mode 100644 authorization/clientset/versioned/clientset.go create mode 100644 authorization/clientset/versioned/doc.go create mode 100644 authorization/clientset/versioned/fake/clientset_generated.go create mode 100644 authorization/clientset/versioned/fake/doc.go create mode 100644 authorization/clientset/versioned/fake/register.go create mode 100644 authorization/clientset/versioned/scheme/doc.go create mode 100644 authorization/clientset/versioned/scheme/register.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/authorization_client.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/clusterpolicy.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/clusterpolicybinding.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/clusterrole.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/clusterrolebinding.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/doc.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/doc.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_authorization_client.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterpolicy.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterpolicybinding.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterrole.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterrolebinding.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_localresourceaccessreview.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_localsubjectaccessreview.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_policy.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_policybinding.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_resourceaccessreview.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_role.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_rolebinding.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_rolebindingrestriction.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_selfsubjectrulesreview.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_subjectaccessreview.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/fake/fake_subjectrulesreview.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/generated_expansion.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/localresourceaccessreview.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/localsubjectaccessreview.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/policy.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/policybinding.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/resourceaccessreview.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/role.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/rolebinding.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/rolebindingrestriction.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/selfsubjectrulesreview.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/subjectaccessreview.go create mode 100644 authorization/clientset/versioned/typed/authorization/v1/subjectrulesreview.go create mode 100644 authorization/informers/externalversions/authorization/interface.go create mode 100644 authorization/informers/externalversions/authorization/v1/clusterpolicy.go create mode 100644 authorization/informers/externalversions/authorization/v1/clusterpolicybinding.go create mode 100644 authorization/informers/externalversions/authorization/v1/clusterrole.go create mode 100644 authorization/informers/externalversions/authorization/v1/clusterrolebinding.go create mode 100644 authorization/informers/externalversions/authorization/v1/interface.go create mode 100644 authorization/informers/externalversions/authorization/v1/policy.go create mode 100644 authorization/informers/externalversions/authorization/v1/policybinding.go create mode 100644 authorization/informers/externalversions/authorization/v1/role.go create mode 100644 authorization/informers/externalversions/authorization/v1/rolebinding.go create mode 100644 authorization/informers/externalversions/authorization/v1/rolebindingrestriction.go create mode 100644 authorization/informers/externalversions/factory.go create mode 100644 authorization/informers/externalversions/generic.go create mode 100644 authorization/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 authorization/listers/authorization/v1/clusterpolicy.go create mode 100644 authorization/listers/authorization/v1/clusterpolicybinding.go create mode 100644 authorization/listers/authorization/v1/clusterrole.go create mode 100644 authorization/listers/authorization/v1/clusterrolebinding.go create mode 100644 authorization/listers/authorization/v1/expansion_generated.go create mode 100644 authorization/listers/authorization/v1/policy.go create mode 100644 authorization/listers/authorization/v1/policybinding.go create mode 100644 authorization/listers/authorization/v1/role.go create mode 100644 authorization/listers/authorization/v1/rolebinding.go create mode 100644 authorization/listers/authorization/v1/rolebindingrestriction.go create mode 100644 build/clientset/versioned/clientset.go create mode 100644 build/clientset/versioned/doc.go create mode 100644 build/clientset/versioned/fake/clientset_generated.go create mode 100644 build/clientset/versioned/fake/doc.go create mode 100644 build/clientset/versioned/fake/register.go create mode 100644 build/clientset/versioned/scheme/doc.go create mode 100644 build/clientset/versioned/scheme/register.go create mode 100644 build/clientset/versioned/typed/build/v1/build.go create mode 100644 build/clientset/versioned/typed/build/v1/build_client.go create mode 100644 build/clientset/versioned/typed/build/v1/buildconfig.go create mode 100644 build/clientset/versioned/typed/build/v1/doc.go create mode 100644 build/clientset/versioned/typed/build/v1/fake/doc.go create mode 100644 build/clientset/versioned/typed/build/v1/fake/fake_build.go create mode 100644 build/clientset/versioned/typed/build/v1/fake/fake_build_client.go create mode 100644 build/clientset/versioned/typed/build/v1/fake/fake_buildconfig.go create mode 100644 build/clientset/versioned/typed/build/v1/generated_expansion.go create mode 100644 build/informers/externalversions/build/interface.go create mode 100644 build/informers/externalversions/build/v1/build.go create mode 100644 build/informers/externalversions/build/v1/buildconfig.go create mode 100644 build/informers/externalversions/build/v1/interface.go create mode 100644 build/informers/externalversions/factory.go create mode 100644 build/informers/externalversions/generic.go create mode 100644 build/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 build/listers/build/v1/build.go create mode 100644 build/listers/build/v1/buildconfig.go create mode 100644 build/listers/build/v1/expansion_generated.go create mode 100644 image/clientset/versioned/clientset.go create mode 100644 image/clientset/versioned/doc.go create mode 100644 image/clientset/versioned/fake/clientset_generated.go create mode 100644 image/clientset/versioned/fake/doc.go create mode 100644 image/clientset/versioned/fake/register.go create mode 100644 image/clientset/versioned/scheme/doc.go create mode 100644 image/clientset/versioned/scheme/register.go create mode 100644 image/clientset/versioned/typed/image/v1/doc.go create mode 100644 image/clientset/versioned/typed/image/v1/fake/doc.go create mode 100644 image/clientset/versioned/typed/image/v1/fake/fake_image.go create mode 100644 image/clientset/versioned/typed/image/v1/fake/fake_image_client.go create mode 100644 image/clientset/versioned/typed/image/v1/fake/fake_imagesignature.go create mode 100644 image/clientset/versioned/typed/image/v1/fake/fake_imagestream.go create mode 100644 image/clientset/versioned/typed/image/v1/fake/fake_imagestreamimage.go create mode 100644 image/clientset/versioned/typed/image/v1/fake/fake_imagestreamimport.go create mode 100644 image/clientset/versioned/typed/image/v1/fake/fake_imagestreammapping.go create mode 100644 image/clientset/versioned/typed/image/v1/fake/fake_imagestreamtag.go create mode 100644 image/clientset/versioned/typed/image/v1/generated_expansion.go create mode 100644 image/clientset/versioned/typed/image/v1/image.go create mode 100644 image/clientset/versioned/typed/image/v1/image_client.go create mode 100644 image/clientset/versioned/typed/image/v1/imagesignature.go create mode 100644 image/clientset/versioned/typed/image/v1/imagestream.go create mode 100644 image/clientset/versioned/typed/image/v1/imagestreamimage.go create mode 100644 image/clientset/versioned/typed/image/v1/imagestreamimport.go create mode 100644 image/clientset/versioned/typed/image/v1/imagestreammapping.go create mode 100644 image/clientset/versioned/typed/image/v1/imagestreamtag.go create mode 100644 image/informers/externalversions/factory.go create mode 100644 image/informers/externalversions/generic.go create mode 100644 image/informers/externalversions/image/interface.go create mode 100644 image/informers/externalversions/image/v1/image.go create mode 100644 image/informers/externalversions/image/v1/imagestream.go create mode 100644 image/informers/externalversions/image/v1/interface.go create mode 100644 image/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 image/listers/image/v1/expansion_generated.go create mode 100644 image/listers/image/v1/image.go create mode 100644 image/listers/image/v1/imagestream.go create mode 100644 network/clientset/versioned/clientset.go create mode 100644 network/clientset/versioned/doc.go create mode 100644 network/clientset/versioned/fake/clientset_generated.go create mode 100644 network/clientset/versioned/fake/doc.go create mode 100644 network/clientset/versioned/fake/register.go create mode 100644 network/clientset/versioned/scheme/doc.go create mode 100644 network/clientset/versioned/scheme/register.go create mode 100644 network/clientset/versioned/typed/network/v1/clusternetwork.go create mode 100644 network/clientset/versioned/typed/network/v1/doc.go create mode 100644 network/clientset/versioned/typed/network/v1/egressnetworkpolicy.go create mode 100644 network/clientset/versioned/typed/network/v1/fake/doc.go create mode 100644 network/clientset/versioned/typed/network/v1/fake/fake_clusternetwork.go create mode 100644 network/clientset/versioned/typed/network/v1/fake/fake_egressnetworkpolicy.go create mode 100644 network/clientset/versioned/typed/network/v1/fake/fake_hostsubnet.go create mode 100644 network/clientset/versioned/typed/network/v1/fake/fake_netnamespace.go create mode 100644 network/clientset/versioned/typed/network/v1/fake/fake_network_client.go create mode 100644 network/clientset/versioned/typed/network/v1/generated_expansion.go create mode 100644 network/clientset/versioned/typed/network/v1/hostsubnet.go create mode 100644 network/clientset/versioned/typed/network/v1/netnamespace.go create mode 100644 network/clientset/versioned/typed/network/v1/network_client.go create mode 100644 network/informers/externalversions/factory.go create mode 100644 network/informers/externalversions/generic.go create mode 100644 network/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 network/informers/externalversions/network/interface.go create mode 100644 network/informers/externalversions/network/v1/clusternetwork.go create mode 100644 network/informers/externalversions/network/v1/egressnetworkpolicy.go create mode 100644 network/informers/externalversions/network/v1/hostsubnet.go create mode 100644 network/informers/externalversions/network/v1/interface.go create mode 100644 network/informers/externalversions/network/v1/netnamespace.go create mode 100644 network/listers/network/v1/clusternetwork.go create mode 100644 network/listers/network/v1/egressnetworkpolicy.go create mode 100644 network/listers/network/v1/expansion_generated.go create mode 100644 network/listers/network/v1/hostsubnet.go create mode 100644 network/listers/network/v1/netnamespace.go create mode 100644 oauth/clientset/versioned/clientset.go create mode 100644 oauth/clientset/versioned/doc.go create mode 100644 oauth/clientset/versioned/fake/clientset_generated.go create mode 100644 oauth/clientset/versioned/fake/doc.go create mode 100644 oauth/clientset/versioned/fake/register.go create mode 100644 oauth/clientset/versioned/scheme/doc.go create mode 100644 oauth/clientset/versioned/scheme/register.go create mode 100644 oauth/clientset/versioned/typed/oauth/v1/doc.go create mode 100644 oauth/clientset/versioned/typed/oauth/v1/fake/doc.go create mode 100644 oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauth_client.go create mode 100644 oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthaccesstoken.go create mode 100644 oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthauthorizetoken.go create mode 100644 oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthclient.go create mode 100644 oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthclientauthorization.go create mode 100644 oauth/clientset/versioned/typed/oauth/v1/generated_expansion.go create mode 100644 oauth/clientset/versioned/typed/oauth/v1/oauth_client.go create mode 100644 oauth/clientset/versioned/typed/oauth/v1/oauthaccesstoken.go create mode 100644 oauth/clientset/versioned/typed/oauth/v1/oauthauthorizetoken.go create mode 100644 oauth/clientset/versioned/typed/oauth/v1/oauthclient.go create mode 100644 oauth/clientset/versioned/typed/oauth/v1/oauthclientauthorization.go create mode 100644 oauth/informers/externalversions/factory.go create mode 100644 oauth/informers/externalversions/generic.go create mode 100644 oauth/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 oauth/informers/externalversions/oauth/interface.go create mode 100644 oauth/informers/externalversions/oauth/v1/interface.go create mode 100644 oauth/informers/externalversions/oauth/v1/oauthaccesstoken.go create mode 100644 oauth/informers/externalversions/oauth/v1/oauthauthorizetoken.go create mode 100644 oauth/informers/externalversions/oauth/v1/oauthclient.go create mode 100644 oauth/informers/externalversions/oauth/v1/oauthclientauthorization.go create mode 100644 oauth/listers/oauth/v1/expansion_generated.go create mode 100644 oauth/listers/oauth/v1/oauthaccesstoken.go create mode 100644 oauth/listers/oauth/v1/oauthauthorizetoken.go create mode 100644 oauth/listers/oauth/v1/oauthclient.go create mode 100644 oauth/listers/oauth/v1/oauthclientauthorization.go create mode 100644 project/clientset/versioned/clientset.go create mode 100644 project/clientset/versioned/doc.go create mode 100644 project/clientset/versioned/fake/clientset_generated.go create mode 100644 project/clientset/versioned/fake/doc.go create mode 100644 project/clientset/versioned/fake/register.go create mode 100644 project/clientset/versioned/scheme/doc.go create mode 100644 project/clientset/versioned/scheme/register.go create mode 100644 project/clientset/versioned/typed/project/v1/doc.go create mode 100644 project/clientset/versioned/typed/project/v1/fake/doc.go create mode 100644 project/clientset/versioned/typed/project/v1/fake/fake_project.go create mode 100644 project/clientset/versioned/typed/project/v1/fake/fake_project_client.go create mode 100644 project/clientset/versioned/typed/project/v1/fake/fake_projectrequest.go create mode 100644 project/clientset/versioned/typed/project/v1/generated_expansion.go create mode 100644 project/clientset/versioned/typed/project/v1/project.go create mode 100644 project/clientset/versioned/typed/project/v1/project_client.go create mode 100644 project/clientset/versioned/typed/project/v1/projectrequest.go create mode 100644 project/informers/externalversions/factory.go create mode 100644 project/informers/externalversions/generic.go create mode 100644 project/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 project/informers/externalversions/project/interface.go create mode 100644 project/informers/externalversions/project/v1/interface.go create mode 100644 project/informers/externalversions/project/v1/project.go create mode 100644 project/listers/project/v1/expansion_generated.go create mode 100644 project/listers/project/v1/project.go create mode 100644 quota/clientset/versioned/clientset.go create mode 100644 quota/clientset/versioned/doc.go create mode 100644 quota/clientset/versioned/fake/clientset_generated.go create mode 100644 quota/clientset/versioned/fake/doc.go create mode 100644 quota/clientset/versioned/fake/register.go create mode 100644 quota/clientset/versioned/scheme/doc.go create mode 100644 quota/clientset/versioned/scheme/register.go create mode 100644 quota/clientset/versioned/typed/quota/v1/appliedclusterresourcequota.go create mode 100644 quota/clientset/versioned/typed/quota/v1/clusterresourcequota.go create mode 100644 quota/clientset/versioned/typed/quota/v1/doc.go create mode 100644 quota/clientset/versioned/typed/quota/v1/fake/doc.go create mode 100644 quota/clientset/versioned/typed/quota/v1/fake/fake_appliedclusterresourcequota.go create mode 100644 quota/clientset/versioned/typed/quota/v1/fake/fake_clusterresourcequota.go create mode 100644 quota/clientset/versioned/typed/quota/v1/fake/fake_quota_client.go create mode 100644 quota/clientset/versioned/typed/quota/v1/generated_expansion.go create mode 100644 quota/clientset/versioned/typed/quota/v1/quota_client.go create mode 100644 quota/informers/externalversions/factory.go create mode 100644 quota/informers/externalversions/generic.go create mode 100644 quota/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 quota/informers/externalversions/quota/interface.go create mode 100644 quota/informers/externalversions/quota/v1/clusterresourcequota.go create mode 100644 quota/informers/externalversions/quota/v1/interface.go create mode 100644 quota/listers/quota/v1/appliedclusterresourcequota.go create mode 100644 quota/listers/quota/v1/clusterresourcequota.go create mode 100644 quota/listers/quota/v1/expansion_generated.go create mode 100644 route/clientset/versioned/clientset.go create mode 100644 route/clientset/versioned/doc.go create mode 100644 route/clientset/versioned/fake/clientset_generated.go create mode 100644 route/clientset/versioned/fake/doc.go create mode 100644 route/clientset/versioned/fake/register.go create mode 100644 route/clientset/versioned/scheme/doc.go create mode 100644 route/clientset/versioned/scheme/register.go create mode 100644 route/clientset/versioned/typed/route/v1/doc.go create mode 100644 route/clientset/versioned/typed/route/v1/fake/doc.go create mode 100644 route/clientset/versioned/typed/route/v1/fake/fake_route.go create mode 100644 route/clientset/versioned/typed/route/v1/fake/fake_route_client.go create mode 100644 route/clientset/versioned/typed/route/v1/generated_expansion.go create mode 100644 route/clientset/versioned/typed/route/v1/route.go create mode 100644 route/clientset/versioned/typed/route/v1/route_client.go create mode 100644 route/informers/externalversions/factory.go create mode 100644 route/informers/externalversions/generic.go create mode 100644 route/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 route/informers/externalversions/route/interface.go create mode 100644 route/informers/externalversions/route/v1/interface.go create mode 100644 route/informers/externalversions/route/v1/route.go create mode 100644 route/listers/route/v1/expansion_generated.go create mode 100644 route/listers/route/v1/route.go create mode 100644 security/clientset/versioned/clientset.go create mode 100644 security/clientset/versioned/doc.go create mode 100644 security/clientset/versioned/fake/clientset_generated.go create mode 100644 security/clientset/versioned/fake/doc.go create mode 100644 security/clientset/versioned/fake/register.go create mode 100644 security/clientset/versioned/scheme/doc.go create mode 100644 security/clientset/versioned/scheme/register.go create mode 100644 security/clientset/versioned/typed/security/v1/doc.go create mode 100644 security/clientset/versioned/typed/security/v1/fake/doc.go create mode 100644 security/clientset/versioned/typed/security/v1/fake/fake_podsecuritypolicyreview.go create mode 100644 security/clientset/versioned/typed/security/v1/fake/fake_podsecuritypolicyselfsubjectreview.go create mode 100644 security/clientset/versioned/typed/security/v1/fake/fake_podsecuritypolicysubjectreview.go create mode 100644 security/clientset/versioned/typed/security/v1/fake/fake_security_client.go create mode 100644 security/clientset/versioned/typed/security/v1/fake/fake_securitycontextconstraints.go create mode 100644 security/clientset/versioned/typed/security/v1/generated_expansion.go create mode 100644 security/clientset/versioned/typed/security/v1/podsecuritypolicyreview.go create mode 100644 security/clientset/versioned/typed/security/v1/podsecuritypolicyselfsubjectreview.go create mode 100644 security/clientset/versioned/typed/security/v1/podsecuritypolicysubjectreview.go create mode 100644 security/clientset/versioned/typed/security/v1/security_client.go create mode 100644 security/clientset/versioned/typed/security/v1/securitycontextconstraints.go create mode 100644 security/informers/externalversions/factory.go create mode 100644 security/informers/externalversions/generic.go create mode 100644 security/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 security/informers/externalversions/security/interface.go create mode 100644 security/informers/externalversions/security/v1/interface.go create mode 100644 security/informers/externalversions/security/v1/securitycontextconstraints.go create mode 100644 security/listers/security/v1/expansion_generated.go create mode 100644 security/listers/security/v1/securitycontextconstraints.go create mode 100644 template/clientset/versioned/clientset.go create mode 100644 template/clientset/versioned/doc.go create mode 100644 template/clientset/versioned/fake/clientset_generated.go create mode 100644 template/clientset/versioned/fake/doc.go create mode 100644 template/clientset/versioned/fake/register.go create mode 100644 template/clientset/versioned/scheme/doc.go create mode 100644 template/clientset/versioned/scheme/register.go create mode 100644 template/clientset/versioned/typed/template/v1/brokertemplateinstance.go create mode 100644 template/clientset/versioned/typed/template/v1/doc.go create mode 100644 template/clientset/versioned/typed/template/v1/fake/doc.go create mode 100644 template/clientset/versioned/typed/template/v1/fake/fake_brokertemplateinstance.go create mode 100644 template/clientset/versioned/typed/template/v1/fake/fake_template.go create mode 100644 template/clientset/versioned/typed/template/v1/fake/fake_template_client.go create mode 100644 template/clientset/versioned/typed/template/v1/fake/fake_templateinstance.go create mode 100644 template/clientset/versioned/typed/template/v1/generated_expansion.go create mode 100644 template/clientset/versioned/typed/template/v1/template.go create mode 100644 template/clientset/versioned/typed/template/v1/template_client.go create mode 100644 template/clientset/versioned/typed/template/v1/templateinstance.go create mode 100644 template/informers/externalversions/factory.go create mode 100644 template/informers/externalversions/generic.go create mode 100644 template/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 template/informers/externalversions/template/interface.go create mode 100644 template/informers/externalversions/template/v1/brokertemplateinstance.go create mode 100644 template/informers/externalversions/template/v1/interface.go create mode 100644 template/informers/externalversions/template/v1/template.go create mode 100644 template/informers/externalversions/template/v1/templateinstance.go create mode 100644 template/listers/template/v1/brokertemplateinstance.go create mode 100644 template/listers/template/v1/expansion_generated.go create mode 100644 template/listers/template/v1/template.go create mode 100644 template/listers/template/v1/templateinstance.go create mode 100644 user/clientset/versioned/clientset.go create mode 100644 user/clientset/versioned/doc.go create mode 100644 user/clientset/versioned/fake/clientset_generated.go create mode 100644 user/clientset/versioned/fake/doc.go create mode 100644 user/clientset/versioned/fake/register.go create mode 100644 user/clientset/versioned/scheme/doc.go create mode 100644 user/clientset/versioned/scheme/register.go create mode 100644 user/clientset/versioned/typed/user/v1/doc.go create mode 100644 user/clientset/versioned/typed/user/v1/fake/doc.go create mode 100644 user/clientset/versioned/typed/user/v1/fake/fake_group.go create mode 100644 user/clientset/versioned/typed/user/v1/fake/fake_identity.go create mode 100644 user/clientset/versioned/typed/user/v1/fake/fake_user.go create mode 100644 user/clientset/versioned/typed/user/v1/fake/fake_user_client.go create mode 100644 user/clientset/versioned/typed/user/v1/fake/fake_useridentitymapping.go create mode 100644 user/clientset/versioned/typed/user/v1/generated_expansion.go create mode 100644 user/clientset/versioned/typed/user/v1/group.go create mode 100644 user/clientset/versioned/typed/user/v1/identity.go create mode 100644 user/clientset/versioned/typed/user/v1/user.go create mode 100644 user/clientset/versioned/typed/user/v1/user_client.go create mode 100644 user/clientset/versioned/typed/user/v1/useridentitymapping.go create mode 100644 user/informers/externalversions/factory.go create mode 100644 user/informers/externalversions/generic.go create mode 100644 user/informers/externalversions/internalinterfaces/factory_interfaces.go create mode 100644 user/informers/externalversions/user/interface.go create mode 100644 user/informers/externalversions/user/v1/group.go create mode 100644 user/informers/externalversions/user/v1/identity.go create mode 100644 user/informers/externalversions/user/v1/interface.go create mode 100644 user/informers/externalversions/user/v1/user.go create mode 100644 user/listers/user/v1/expansion_generated.go create mode 100644 user/listers/user/v1/group.go create mode 100644 user/listers/user/v1/identity.go create mode 100644 user/listers/user/v1/user.go diff --git a/apps/clientset/versioned/clientset.go b/apps/clientset/versioned/clientset.go new file mode 100644 index 0000000000..1e4929c884 --- /dev/null +++ b/apps/clientset/versioned/clientset.go @@ -0,0 +1,82 @@ +package versioned + +import ( + glog "github.com/golang/glog" + appsv1 "github.com/openshift/client-go/apps/clientset/versioned/typed/apps/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + AppsV1() appsv1.AppsV1Interface + // Deprecated: please explicitly pick a version if possible. + Apps() appsv1.AppsV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + appsV1 *appsv1.AppsV1Client +} + +// AppsV1 retrieves the AppsV1Client +func (c *Clientset) AppsV1() appsv1.AppsV1Interface { + return c.appsV1 +} + +// Deprecated: Apps retrieves the default version of AppsClient. +// Please explicitly pick a version. +func (c *Clientset) Apps() appsv1.AppsV1Interface { + return c.appsV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.appsV1, err = appsv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.appsV1 = appsv1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.appsV1 = appsv1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/apps/clientset/versioned/doc.go b/apps/clientset/versioned/doc.go new file mode 100644 index 0000000000..72f92921e6 --- /dev/null +++ b/apps/clientset/versioned/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated clientset. +package versioned diff --git a/apps/clientset/versioned/fake/clientset_generated.go b/apps/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..782fc40f48 --- /dev/null +++ b/apps/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,55 @@ +package fake + +import ( + clientset "github.com/openshift/client-go/apps/clientset/versioned" + appsv1 "github.com/openshift/client-go/apps/clientset/versioned/typed/apps/v1" + fakeappsv1 "github.com/openshift/client-go/apps/clientset/versioned/typed/apps/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := testing.Fake{} + fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) + fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// AppsV1 retrieves the AppsV1Client +func (c *Clientset) AppsV1() appsv1.AppsV1Interface { + return &fakeappsv1.FakeAppsV1{Fake: &c.Fake} +} + +// Apps retrieves the AppsV1Client +func (c *Clientset) Apps() appsv1.AppsV1Interface { + return &fakeappsv1.FakeAppsV1{Fake: &c.Fake} +} diff --git a/apps/clientset/versioned/fake/doc.go b/apps/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..760aaa8253 --- /dev/null +++ b/apps/clientset/versioned/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated fake clientset. +package fake diff --git a/apps/clientset/versioned/fake/register.go b/apps/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..c1edfeaa54 --- /dev/null +++ b/apps/clientset/versioned/fake/register.go @@ -0,0 +1,37 @@ +package fake + +import ( + appsv1 "github.com/openshift/api/apps/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + appsv1.AddToScheme(scheme) + +} diff --git a/apps/clientset/versioned/scheme/doc.go b/apps/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..d1c53d03b2 --- /dev/null +++ b/apps/clientset/versioned/scheme/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/apps/clientset/versioned/scheme/register.go b/apps/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..cf3faf7671 --- /dev/null +++ b/apps/clientset/versioned/scheme/register.go @@ -0,0 +1,37 @@ +package scheme + +import ( + appsv1 "github.com/openshift/api/apps/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + appsv1.AddToScheme(scheme) + +} diff --git a/apps/clientset/versioned/typed/apps/v1/apps_client.go b/apps/clientset/versioned/typed/apps/v1/apps_client.go new file mode 100644 index 0000000000..03b5b09fcc --- /dev/null +++ b/apps/clientset/versioned/typed/apps/v1/apps_client.go @@ -0,0 +1,72 @@ +package v1 + +import ( + v1 "github.com/openshift/api/apps/v1" + "github.com/openshift/client-go/apps/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type AppsV1Interface interface { + RESTClient() rest.Interface + DeploymentConfigsGetter +} + +// AppsV1Client is used to interact with features provided by the apps.openshift.io group. +type AppsV1Client struct { + restClient rest.Interface +} + +func (c *AppsV1Client) DeploymentConfigs(namespace string) DeploymentConfigInterface { + return newDeploymentConfigs(c, namespace) +} + +// NewForConfig creates a new AppsV1Client for the given config. +func NewForConfig(c *rest.Config) (*AppsV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &AppsV1Client{client}, nil +} + +// NewForConfigOrDie creates a new AppsV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *AppsV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AppsV1Client for the given RESTClient. +func New(c rest.Interface) *AppsV1Client { + return &AppsV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *AppsV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/apps/clientset/versioned/typed/apps/v1/deploymentconfig.go b/apps/clientset/versioned/typed/apps/v1/deploymentconfig.go new file mode 100644 index 0000000000..243118ecd0 --- /dev/null +++ b/apps/clientset/versioned/typed/apps/v1/deploymentconfig.go @@ -0,0 +1,218 @@ +package v1 + +import ( + v1 "github.com/openshift/api/apps/v1" + scheme "github.com/openshift/client-go/apps/clientset/versioned/scheme" + v1beta1 "k8s.io/api/extensions/v1beta1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// DeploymentConfigsGetter has a method to return a DeploymentConfigInterface. +// A group's client should implement this interface. +type DeploymentConfigsGetter interface { + DeploymentConfigs(namespace string) DeploymentConfigInterface +} + +// DeploymentConfigInterface has methods to work with DeploymentConfig resources. +type DeploymentConfigInterface interface { + Create(*v1.DeploymentConfig) (*v1.DeploymentConfig, error) + Update(*v1.DeploymentConfig) (*v1.DeploymentConfig, error) + UpdateStatus(*v1.DeploymentConfig) (*v1.DeploymentConfig, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.DeploymentConfig, error) + List(opts meta_v1.ListOptions) (*v1.DeploymentConfigList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.DeploymentConfig, err error) + Instantiate(deploymentConfigName string, deploymentRequest *v1.DeploymentRequest) (*v1.DeploymentConfig, error) + Rollback(deploymentConfigName string, deploymentConfigRollback *v1.DeploymentConfigRollback) (*v1.DeploymentConfig, error) + GetScale(deploymentConfigName string, options meta_v1.GetOptions) (*v1beta1.Scale, error) + UpdateScale(deploymentConfigName string, scale *v1beta1.Scale) (*v1beta1.Scale, error) + + DeploymentConfigExpansion +} + +// deploymentConfigs implements DeploymentConfigInterface +type deploymentConfigs struct { + client rest.Interface + ns string +} + +// newDeploymentConfigs returns a DeploymentConfigs +func newDeploymentConfigs(c *AppsV1Client, namespace string) *deploymentConfigs { + return &deploymentConfigs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the deploymentConfig, and returns the corresponding deploymentConfig object, and an error if there is any. +func (c *deploymentConfigs) Get(name string, options meta_v1.GetOptions) (result *v1.DeploymentConfig, err error) { + result = &v1.DeploymentConfig{} + err = c.client.Get(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of DeploymentConfigs that match those selectors. +func (c *deploymentConfigs) List(opts meta_v1.ListOptions) (result *v1.DeploymentConfigList, err error) { + result = &v1.DeploymentConfigList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("deploymentconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested deploymentConfigs. +func (c *deploymentConfigs) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("deploymentconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a deploymentConfig and creates it. Returns the server's representation of the deploymentConfig, and an error, if there is any. +func (c *deploymentConfigs) Create(deploymentConfig *v1.DeploymentConfig) (result *v1.DeploymentConfig, err error) { + result = &v1.DeploymentConfig{} + err = c.client.Post(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Body(deploymentConfig). + Do(). + Into(result) + return +} + +// Update takes the representation of a deploymentConfig and updates it. Returns the server's representation of the deploymentConfig, and an error, if there is any. +func (c *deploymentConfigs) Update(deploymentConfig *v1.DeploymentConfig) (result *v1.DeploymentConfig, err error) { + result = &v1.DeploymentConfig{} + err = c.client.Put(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(deploymentConfig.Name). + Body(deploymentConfig). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *deploymentConfigs) UpdateStatus(deploymentConfig *v1.DeploymentConfig) (result *v1.DeploymentConfig, err error) { + result = &v1.DeploymentConfig{} + err = c.client.Put(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(deploymentConfig.Name). + SubResource("status"). + Body(deploymentConfig). + Do(). + Into(result) + return +} + +// Delete takes name of the deploymentConfig and deletes it. Returns an error if one occurs. +func (c *deploymentConfigs) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *deploymentConfigs) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("deploymentconfigs"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched deploymentConfig. +func (c *deploymentConfigs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.DeploymentConfig, err error) { + result = &v1.DeploymentConfig{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("deploymentconfigs"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} + +// Instantiate takes the representation of a deploymentRequest and creates it. Returns the server's representation of the deploymentConfig, and an error, if there is any. +func (c *deploymentConfigs) Instantiate(deploymentConfigName string, deploymentRequest *v1.DeploymentRequest) (result *v1.DeploymentConfig, err error) { + result = &v1.DeploymentConfig{} + err = c.client.Post(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(deploymentConfigName). + SubResource("instantiate"). + Body(deploymentRequest). + Do(). + Into(result) + return +} + +// Rollback takes the representation of a deploymentConfigRollback and creates it. Returns the server's representation of the deploymentConfig, and an error, if there is any. +func (c *deploymentConfigs) Rollback(deploymentConfigName string, deploymentConfigRollback *v1.DeploymentConfigRollback) (result *v1.DeploymentConfig, err error) { + result = &v1.DeploymentConfig{} + err = c.client.Post(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(deploymentConfigName). + SubResource("rollback"). + Body(deploymentConfigRollback). + Do(). + Into(result) + return +} + +// GetScale takes name of the deploymentConfig, and returns the corresponding v1beta1.Scale object, and an error if there is any. +func (c *deploymentConfigs) GetScale(deploymentConfigName string, options meta_v1.GetOptions) (result *v1beta1.Scale, err error) { + result = &v1beta1.Scale{} + err = c.client.Get(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(deploymentConfigName). + SubResource("scale"). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. +func (c *deploymentConfigs) UpdateScale(deploymentConfigName string, scale *v1beta1.Scale) (result *v1beta1.Scale, err error) { + result = &v1beta1.Scale{} + err = c.client.Put(). + Namespace(c.ns). + Resource("deploymentconfigs"). + Name(deploymentConfigName). + SubResource("scale"). + Body(scale). + Do(). + Into(result) + return +} diff --git a/apps/clientset/versioned/typed/apps/v1/doc.go b/apps/clientset/versioned/typed/apps/v1/doc.go new file mode 100644 index 0000000000..0e93c2c5e7 --- /dev/null +++ b/apps/clientset/versioned/typed/apps/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated typed clients. +package v1 diff --git a/apps/clientset/versioned/typed/apps/v1/fake/doc.go b/apps/clientset/versioned/typed/apps/v1/fake/doc.go new file mode 100644 index 0000000000..e3bbd12a2b --- /dev/null +++ b/apps/clientset/versioned/typed/apps/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// Package fake has the automatically generated clients. +package fake diff --git a/apps/clientset/versioned/typed/apps/v1/fake/fake_apps_client.go b/apps/clientset/versioned/typed/apps/v1/fake/fake_apps_client.go new file mode 100644 index 0000000000..890caaff0d --- /dev/null +++ b/apps/clientset/versioned/typed/apps/v1/fake/fake_apps_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + v1 "github.com/openshift/client-go/apps/clientset/versioned/typed/apps/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeAppsV1 struct { + *testing.Fake +} + +func (c *FakeAppsV1) DeploymentConfigs(namespace string) v1.DeploymentConfigInterface { + return &FakeDeploymentConfigs{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAppsV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/apps/clientset/versioned/typed/apps/v1/fake/fake_deploymentconfig.go b/apps/clientset/versioned/typed/apps/v1/fake/fake_deploymentconfig.go new file mode 100644 index 0000000000..0fb5cf3038 --- /dev/null +++ b/apps/clientset/versioned/typed/apps/v1/fake/fake_deploymentconfig.go @@ -0,0 +1,167 @@ +package fake + +import ( + apps_v1 "github.com/openshift/api/apps/v1" + v1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeDeploymentConfigs implements DeploymentConfigInterface +type FakeDeploymentConfigs struct { + Fake *FakeAppsV1 + ns string +} + +var deploymentconfigsResource = schema.GroupVersionResource{Group: "apps.openshift.io", Version: "v1", Resource: "deploymentconfigs"} + +var deploymentconfigsKind = schema.GroupVersionKind{Group: "apps.openshift.io", Version: "v1", Kind: "DeploymentConfig"} + +// Get takes name of the deploymentConfig, and returns the corresponding deploymentConfig object, and an error if there is any. +func (c *FakeDeploymentConfigs) Get(name string, options v1.GetOptions) (result *apps_v1.DeploymentConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(deploymentconfigsResource, c.ns, name), &apps_v1.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*apps_v1.DeploymentConfig), err +} + +// List takes label and field selectors, and returns the list of DeploymentConfigs that match those selectors. +func (c *FakeDeploymentConfigs) List(opts v1.ListOptions) (result *apps_v1.DeploymentConfigList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(deploymentconfigsResource, deploymentconfigsKind, c.ns, opts), &apps_v1.DeploymentConfigList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &apps_v1.DeploymentConfigList{} + for _, item := range obj.(*apps_v1.DeploymentConfigList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested deploymentConfigs. +func (c *FakeDeploymentConfigs) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(deploymentconfigsResource, c.ns, opts)) + +} + +// Create takes the representation of a deploymentConfig and creates it. Returns the server's representation of the deploymentConfig, and an error, if there is any. +func (c *FakeDeploymentConfigs) Create(deploymentConfig *apps_v1.DeploymentConfig) (result *apps_v1.DeploymentConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(deploymentconfigsResource, c.ns, deploymentConfig), &apps_v1.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*apps_v1.DeploymentConfig), err +} + +// Update takes the representation of a deploymentConfig and updates it. Returns the server's representation of the deploymentConfig, and an error, if there is any. +func (c *FakeDeploymentConfigs) Update(deploymentConfig *apps_v1.DeploymentConfig) (result *apps_v1.DeploymentConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(deploymentconfigsResource, c.ns, deploymentConfig), &apps_v1.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*apps_v1.DeploymentConfig), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeDeploymentConfigs) UpdateStatus(deploymentConfig *apps_v1.DeploymentConfig) (*apps_v1.DeploymentConfig, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(deploymentconfigsResource, "status", c.ns, deploymentConfig), &apps_v1.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*apps_v1.DeploymentConfig), err +} + +// Delete takes name of the deploymentConfig and deletes it. Returns an error if one occurs. +func (c *FakeDeploymentConfigs) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(deploymentconfigsResource, c.ns, name), &apps_v1.DeploymentConfig{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeDeploymentConfigs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(deploymentconfigsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &apps_v1.DeploymentConfigList{}) + return err +} + +// Patch applies the patch and returns the patched deploymentConfig. +func (c *FakeDeploymentConfigs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apps_v1.DeploymentConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(deploymentconfigsResource, c.ns, name, data, subresources...), &apps_v1.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*apps_v1.DeploymentConfig), err +} + +// Instantiate takes the representation of a deploymentRequest and creates it. Returns the server's representation of the deploymentConfig, and an error, if there is any. +func (c *FakeDeploymentConfigs) Instantiate(deploymentConfigName string, deploymentRequest *apps_v1.DeploymentRequest) (result *apps_v1.DeploymentConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateSubresourceAction(deploymentconfigsResource, deploymentConfigName, "instantiate", c.ns, deploymentRequest), &apps_v1.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*apps_v1.DeploymentConfig), err +} + +// Rollback takes the representation of a deploymentConfigRollback and creates it. Returns the server's representation of the deploymentConfig, and an error, if there is any. +func (c *FakeDeploymentConfigs) Rollback(deploymentConfigName string, deploymentConfigRollback *apps_v1.DeploymentConfigRollback) (result *apps_v1.DeploymentConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateSubresourceAction(deploymentconfigsResource, deploymentConfigName, "rollback", c.ns, deploymentConfigRollback), &apps_v1.DeploymentConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*apps_v1.DeploymentConfig), err +} + +// GetScale takes name of the deploymentConfig, and returns the corresponding scale object, and an error if there is any. +func (c *FakeDeploymentConfigs) GetScale(deploymentConfigName string, options v1.GetOptions) (result *v1beta1.Scale, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetSubresourceAction(deploymentconfigsResource, c.ns, "scale", deploymentConfigName), &v1beta1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Scale), err +} + +// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. +func (c *FakeDeploymentConfigs) UpdateScale(deploymentConfigName string, scale *v1beta1.Scale) (result *v1beta1.Scale, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(deploymentconfigsResource, "scale", c.ns, scale), &v1beta1.Scale{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.Scale), err +} diff --git a/apps/clientset/versioned/typed/apps/v1/generated_expansion.go b/apps/clientset/versioned/typed/apps/v1/generated_expansion.go new file mode 100644 index 0000000000..113ade54be --- /dev/null +++ b/apps/clientset/versioned/typed/apps/v1/generated_expansion.go @@ -0,0 +1,3 @@ +package v1 + +type DeploymentConfigExpansion interface{} diff --git a/apps/informers/externalversions/apps/interface.go b/apps/informers/externalversions/apps/interface.go new file mode 100644 index 0000000000..6c779ce002 --- /dev/null +++ b/apps/informers/externalversions/apps/interface.go @@ -0,0 +1,28 @@ +// This file was automatically generated by informer-gen + +package apps + +import ( + v1 "github.com/openshift/client-go/apps/informers/externalversions/apps/v1" + internalinterfaces "github.com/openshift/client-go/apps/informers/externalversions/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &group{f} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.SharedInformerFactory) +} diff --git a/apps/informers/externalversions/apps/v1/deploymentconfig.go b/apps/informers/externalversions/apps/v1/deploymentconfig.go new file mode 100644 index 0000000000..b66d36e1c7 --- /dev/null +++ b/apps/informers/externalversions/apps/v1/deploymentconfig.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + apps_v1 "github.com/openshift/api/apps/v1" + versioned "github.com/openshift/client-go/apps/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/apps/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/apps/listers/apps/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// DeploymentConfigInformer provides access to a shared informer and lister for +// DeploymentConfigs. +type DeploymentConfigInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.DeploymentConfigLister +} + +type deploymentConfigInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewDeploymentConfigInformer constructs a new informer for DeploymentConfig type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.AppsV1().DeploymentConfigs(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.AppsV1().DeploymentConfigs(namespace).Watch(options) + }, + }, + &apps_v1.DeploymentConfig{}, + resyncPeriod, + indexers, + ) +} + +func defaultDeploymentConfigInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewDeploymentConfigInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *deploymentConfigInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apps_v1.DeploymentConfig{}, defaultDeploymentConfigInformer) +} + +func (f *deploymentConfigInformer) Lister() v1.DeploymentConfigLister { + return v1.NewDeploymentConfigLister(f.Informer().GetIndexer()) +} diff --git a/apps/informers/externalversions/apps/v1/interface.go b/apps/informers/externalversions/apps/v1/interface.go new file mode 100644 index 0000000000..ff277e33c0 --- /dev/null +++ b/apps/informers/externalversions/apps/v1/interface.go @@ -0,0 +1,27 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + internalinterfaces "github.com/openshift/client-go/apps/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // DeploymentConfigs returns a DeploymentConfigInformer. + DeploymentConfigs() DeploymentConfigInformer +} + +type version struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &version{f} +} + +// DeploymentConfigs returns a DeploymentConfigInformer. +func (v *version) DeploymentConfigs() DeploymentConfigInformer { + return &deploymentConfigInformer{factory: v.SharedInformerFactory} +} diff --git a/apps/informers/externalversions/factory.go b/apps/informers/externalversions/factory.go new file mode 100644 index 0000000000..33e5e135d4 --- /dev/null +++ b/apps/informers/externalversions/factory.go @@ -0,0 +1,102 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + versioned "github.com/openshift/client-go/apps/clientset/versioned" + apps "github.com/openshift/client-go/apps/informers/externalversions/apps" + internalinterfaces "github.com/openshift/client-go/apps/informers/externalversions/internalinterfaces" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + reflect "reflect" + sync "sync" + time "time" +) + +type sharedInformerFactory struct { + client versioned.Interface + lock sync.Mutex + defaultResync time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return &sharedInformerFactory{ + client: client, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + } +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + informer = newFunc(f.client, f.defaultResync) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Apps() apps.Interface +} + +func (f *sharedInformerFactory) Apps() apps.Interface { + return apps.New(f) +} diff --git a/apps/informers/externalversions/generic.go b/apps/informers/externalversions/generic.go new file mode 100644 index 0000000000..7bfdab0613 --- /dev/null +++ b/apps/informers/externalversions/generic.go @@ -0,0 +1,45 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + "fmt" + v1 "github.com/openshift/api/apps/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=Apps, Version=V1 + case v1.SchemeGroupVersion.WithResource("deploymentconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().DeploymentConfigs().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/apps/informers/externalversions/internalinterfaces/factory_interfaces.go b/apps/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..9114f902b5 --- /dev/null +++ b/apps/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,18 @@ +// This file was automatically generated by informer-gen + +package internalinterfaces + +import ( + versioned "github.com/openshift/client-go/apps/clientset/versioned" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} diff --git a/apps/listers/apps/v1/deploymentconfig.go b/apps/listers/apps/v1/deploymentconfig.go new file mode 100644 index 0000000000..31cd17bb8f --- /dev/null +++ b/apps/listers/apps/v1/deploymentconfig.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DeploymentConfigLister helps list DeploymentConfigs. +type DeploymentConfigLister interface { + // List lists all DeploymentConfigs in the indexer. + List(selector labels.Selector) (ret []*v1.DeploymentConfig, err error) + // DeploymentConfigs returns an object that can list and get DeploymentConfigs. + DeploymentConfigs(namespace string) DeploymentConfigNamespaceLister + DeploymentConfigListerExpansion +} + +// deploymentConfigLister implements the DeploymentConfigLister interface. +type deploymentConfigLister struct { + indexer cache.Indexer +} + +// NewDeploymentConfigLister returns a new DeploymentConfigLister. +func NewDeploymentConfigLister(indexer cache.Indexer) DeploymentConfigLister { + return &deploymentConfigLister{indexer: indexer} +} + +// List lists all DeploymentConfigs in the indexer. +func (s *deploymentConfigLister) List(selector labels.Selector) (ret []*v1.DeploymentConfig, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.DeploymentConfig)) + }) + return ret, err +} + +// DeploymentConfigs returns an object that can list and get DeploymentConfigs. +func (s *deploymentConfigLister) DeploymentConfigs(namespace string) DeploymentConfigNamespaceLister { + return deploymentConfigNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DeploymentConfigNamespaceLister helps list and get DeploymentConfigs. +type DeploymentConfigNamespaceLister interface { + // List lists all DeploymentConfigs in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.DeploymentConfig, err error) + // Get retrieves the DeploymentConfig from the indexer for a given namespace and name. + Get(name string) (*v1.DeploymentConfig, error) + DeploymentConfigNamespaceListerExpansion +} + +// deploymentConfigNamespaceLister implements the DeploymentConfigNamespaceLister +// interface. +type deploymentConfigNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all DeploymentConfigs in the indexer for a given namespace. +func (s deploymentConfigNamespaceLister) List(selector labels.Selector) (ret []*v1.DeploymentConfig, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.DeploymentConfig)) + }) + return ret, err +} + +// Get retrieves the DeploymentConfig from the indexer for a given namespace and name. +func (s deploymentConfigNamespaceLister) Get(name string) (*v1.DeploymentConfig, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("deploymentconfig"), name) + } + return obj.(*v1.DeploymentConfig), nil +} diff --git a/apps/listers/apps/v1/expansion_generated.go b/apps/listers/apps/v1/expansion_generated.go new file mode 100644 index 0000000000..c9ee4aa5a1 --- /dev/null +++ b/apps/listers/apps/v1/expansion_generated.go @@ -0,0 +1,11 @@ +// This file was automatically generated by lister-gen + +package v1 + +// DeploymentConfigListerExpansion allows custom methods to be added to +// DeploymentConfigLister. +type DeploymentConfigListerExpansion interface{} + +// DeploymentConfigNamespaceListerExpansion allows custom methods to be added to +// DeploymentConfigNamespaceLister. +type DeploymentConfigNamespaceListerExpansion interface{} diff --git a/authorization/clientset/versioned/clientset.go b/authorization/clientset/versioned/clientset.go new file mode 100644 index 0000000000..bb32fa6199 --- /dev/null +++ b/authorization/clientset/versioned/clientset.go @@ -0,0 +1,82 @@ +package versioned + +import ( + glog "github.com/golang/glog" + authorizationv1 "github.com/openshift/client-go/authorization/clientset/versioned/typed/authorization/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + AuthorizationV1() authorizationv1.AuthorizationV1Interface + // Deprecated: please explicitly pick a version if possible. + Authorization() authorizationv1.AuthorizationV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + authorizationV1 *authorizationv1.AuthorizationV1Client +} + +// AuthorizationV1 retrieves the AuthorizationV1Client +func (c *Clientset) AuthorizationV1() authorizationv1.AuthorizationV1Interface { + return c.authorizationV1 +} + +// Deprecated: Authorization retrieves the default version of AuthorizationClient. +// Please explicitly pick a version. +func (c *Clientset) Authorization() authorizationv1.AuthorizationV1Interface { + return c.authorizationV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.authorizationV1, err = authorizationv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.authorizationV1 = authorizationv1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.authorizationV1 = authorizationv1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/authorization/clientset/versioned/doc.go b/authorization/clientset/versioned/doc.go new file mode 100644 index 0000000000..72f92921e6 --- /dev/null +++ b/authorization/clientset/versioned/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated clientset. +package versioned diff --git a/authorization/clientset/versioned/fake/clientset_generated.go b/authorization/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..18bbfb19d2 --- /dev/null +++ b/authorization/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,55 @@ +package fake + +import ( + clientset "github.com/openshift/client-go/authorization/clientset/versioned" + authorizationv1 "github.com/openshift/client-go/authorization/clientset/versioned/typed/authorization/v1" + fakeauthorizationv1 "github.com/openshift/client-go/authorization/clientset/versioned/typed/authorization/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := testing.Fake{} + fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) + fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// AuthorizationV1 retrieves the AuthorizationV1Client +func (c *Clientset) AuthorizationV1() authorizationv1.AuthorizationV1Interface { + return &fakeauthorizationv1.FakeAuthorizationV1{Fake: &c.Fake} +} + +// Authorization retrieves the AuthorizationV1Client +func (c *Clientset) Authorization() authorizationv1.AuthorizationV1Interface { + return &fakeauthorizationv1.FakeAuthorizationV1{Fake: &c.Fake} +} diff --git a/authorization/clientset/versioned/fake/doc.go b/authorization/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..760aaa8253 --- /dev/null +++ b/authorization/clientset/versioned/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated fake clientset. +package fake diff --git a/authorization/clientset/versioned/fake/register.go b/authorization/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..dc4e224cda --- /dev/null +++ b/authorization/clientset/versioned/fake/register.go @@ -0,0 +1,37 @@ +package fake + +import ( + authorizationv1 "github.com/openshift/api/authorization/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + authorizationv1.AddToScheme(scheme) + +} diff --git a/authorization/clientset/versioned/scheme/doc.go b/authorization/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..d1c53d03b2 --- /dev/null +++ b/authorization/clientset/versioned/scheme/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/authorization/clientset/versioned/scheme/register.go b/authorization/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..8d15546a57 --- /dev/null +++ b/authorization/clientset/versioned/scheme/register.go @@ -0,0 +1,37 @@ +package scheme + +import ( + authorizationv1 "github.com/openshift/api/authorization/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + authorizationv1.AddToScheme(scheme) + +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/authorization_client.go b/authorization/clientset/versioned/typed/authorization/v1/authorization_client.go new file mode 100644 index 0000000000..7c0b417312 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/authorization_client.go @@ -0,0 +1,142 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + "github.com/openshift/client-go/authorization/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type AuthorizationV1Interface interface { + RESTClient() rest.Interface + ClusterPoliciesGetter + ClusterPolicyBindingsGetter + ClusterRolesGetter + ClusterRoleBindingsGetter + LocalResourceAccessReviewsGetter + LocalSubjectAccessReviewsGetter + PoliciesGetter + PolicyBindingsGetter + ResourceAccessReviewsGetter + RolesGetter + RoleBindingsGetter + RoleBindingRestrictionsGetter + SelfSubjectRulesReviewsGetter + SubjectAccessReviewsGetter + SubjectRulesReviewsGetter +} + +// AuthorizationV1Client is used to interact with features provided by the authorization.openshift.io group. +type AuthorizationV1Client struct { + restClient rest.Interface +} + +func (c *AuthorizationV1Client) ClusterPolicies() ClusterPolicyInterface { + return newClusterPolicies(c) +} + +func (c *AuthorizationV1Client) ClusterPolicyBindings() ClusterPolicyBindingInterface { + return newClusterPolicyBindings(c) +} + +func (c *AuthorizationV1Client) ClusterRoles() ClusterRoleInterface { + return newClusterRoles(c) +} + +func (c *AuthorizationV1Client) ClusterRoleBindings() ClusterRoleBindingInterface { + return newClusterRoleBindings(c) +} + +func (c *AuthorizationV1Client) LocalResourceAccessReviews(namespace string) LocalResourceAccessReviewInterface { + return newLocalResourceAccessReviews(c, namespace) +} + +func (c *AuthorizationV1Client) LocalSubjectAccessReviews(namespace string) LocalSubjectAccessReviewInterface { + return newLocalSubjectAccessReviews(c, namespace) +} + +func (c *AuthorizationV1Client) Policies(namespace string) PolicyInterface { + return newPolicies(c, namespace) +} + +func (c *AuthorizationV1Client) PolicyBindings(namespace string) PolicyBindingInterface { + return newPolicyBindings(c, namespace) +} + +func (c *AuthorizationV1Client) ResourceAccessReviews() ResourceAccessReviewInterface { + return newResourceAccessReviews(c) +} + +func (c *AuthorizationV1Client) Roles(namespace string) RoleInterface { + return newRoles(c, namespace) +} + +func (c *AuthorizationV1Client) RoleBindings(namespace string) RoleBindingInterface { + return newRoleBindings(c, namespace) +} + +func (c *AuthorizationV1Client) RoleBindingRestrictions(namespace string) RoleBindingRestrictionInterface { + return newRoleBindingRestrictions(c, namespace) +} + +func (c *AuthorizationV1Client) SelfSubjectRulesReviews(namespace string) SelfSubjectRulesReviewInterface { + return newSelfSubjectRulesReviews(c, namespace) +} + +func (c *AuthorizationV1Client) SubjectAccessReviews() SubjectAccessReviewInterface { + return newSubjectAccessReviews(c) +} + +func (c *AuthorizationV1Client) SubjectRulesReviews(namespace string) SubjectRulesReviewInterface { + return newSubjectRulesReviews(c, namespace) +} + +// NewForConfig creates a new AuthorizationV1Client for the given config. +func NewForConfig(c *rest.Config) (*AuthorizationV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &AuthorizationV1Client{client}, nil +} + +// NewForConfigOrDie creates a new AuthorizationV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *AuthorizationV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AuthorizationV1Client for the given RESTClient. +func New(c rest.Interface) *AuthorizationV1Client { + return &AuthorizationV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *AuthorizationV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/clusterpolicy.go b/authorization/clientset/versioned/typed/authorization/v1/clusterpolicy.go new file mode 100644 index 0000000000..629cf4c0c7 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/clusterpolicy.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + scheme "github.com/openshift/client-go/authorization/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ClusterPoliciesGetter has a method to return a ClusterPolicyInterface. +// A group's client should implement this interface. +type ClusterPoliciesGetter interface { + ClusterPolicies() ClusterPolicyInterface +} + +// ClusterPolicyInterface has methods to work with ClusterPolicy resources. +type ClusterPolicyInterface interface { + Create(*v1.ClusterPolicy) (*v1.ClusterPolicy, error) + Update(*v1.ClusterPolicy) (*v1.ClusterPolicy, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.ClusterPolicy, error) + List(opts meta_v1.ListOptions) (*v1.ClusterPolicyList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterPolicy, err error) + ClusterPolicyExpansion +} + +// clusterPolicies implements ClusterPolicyInterface +type clusterPolicies struct { + client rest.Interface +} + +// newClusterPolicies returns a ClusterPolicies +func newClusterPolicies(c *AuthorizationV1Client) *clusterPolicies { + return &clusterPolicies{ + client: c.RESTClient(), + } +} + +// Get takes name of the clusterPolicy, and returns the corresponding clusterPolicy object, and an error if there is any. +func (c *clusterPolicies) Get(name string, options meta_v1.GetOptions) (result *v1.ClusterPolicy, err error) { + result = &v1.ClusterPolicy{} + err = c.client.Get(). + Resource("clusterpolicies"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterPolicies that match those selectors. +func (c *clusterPolicies) List(opts meta_v1.ListOptions) (result *v1.ClusterPolicyList, err error) { + result = &v1.ClusterPolicyList{} + err = c.client.Get(). + Resource("clusterpolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterPolicies. +func (c *clusterPolicies) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("clusterpolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a clusterPolicy and creates it. Returns the server's representation of the clusterPolicy, and an error, if there is any. +func (c *clusterPolicies) Create(clusterPolicy *v1.ClusterPolicy) (result *v1.ClusterPolicy, err error) { + result = &v1.ClusterPolicy{} + err = c.client.Post(). + Resource("clusterpolicies"). + Body(clusterPolicy). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterPolicy and updates it. Returns the server's representation of the clusterPolicy, and an error, if there is any. +func (c *clusterPolicies) Update(clusterPolicy *v1.ClusterPolicy) (result *v1.ClusterPolicy, err error) { + result = &v1.ClusterPolicy{} + err = c.client.Put(). + Resource("clusterpolicies"). + Name(clusterPolicy.Name). + Body(clusterPolicy). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterPolicy and deletes it. Returns an error if one occurs. +func (c *clusterPolicies) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clusterpolicies"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterPolicies) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("clusterpolicies"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched clusterPolicy. +func (c *clusterPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterPolicy, err error) { + result = &v1.ClusterPolicy{} + err = c.client.Patch(pt). + Resource("clusterpolicies"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/clusterpolicybinding.go b/authorization/clientset/versioned/typed/authorization/v1/clusterpolicybinding.go new file mode 100644 index 0000000000..cb97a614a5 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/clusterpolicybinding.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + scheme "github.com/openshift/client-go/authorization/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ClusterPolicyBindingsGetter has a method to return a ClusterPolicyBindingInterface. +// A group's client should implement this interface. +type ClusterPolicyBindingsGetter interface { + ClusterPolicyBindings() ClusterPolicyBindingInterface +} + +// ClusterPolicyBindingInterface has methods to work with ClusterPolicyBinding resources. +type ClusterPolicyBindingInterface interface { + Create(*v1.ClusterPolicyBinding) (*v1.ClusterPolicyBinding, error) + Update(*v1.ClusterPolicyBinding) (*v1.ClusterPolicyBinding, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.ClusterPolicyBinding, error) + List(opts meta_v1.ListOptions) (*v1.ClusterPolicyBindingList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterPolicyBinding, err error) + ClusterPolicyBindingExpansion +} + +// clusterPolicyBindings implements ClusterPolicyBindingInterface +type clusterPolicyBindings struct { + client rest.Interface +} + +// newClusterPolicyBindings returns a ClusterPolicyBindings +func newClusterPolicyBindings(c *AuthorizationV1Client) *clusterPolicyBindings { + return &clusterPolicyBindings{ + client: c.RESTClient(), + } +} + +// Get takes name of the clusterPolicyBinding, and returns the corresponding clusterPolicyBinding object, and an error if there is any. +func (c *clusterPolicyBindings) Get(name string, options meta_v1.GetOptions) (result *v1.ClusterPolicyBinding, err error) { + result = &v1.ClusterPolicyBinding{} + err = c.client.Get(). + Resource("clusterpolicybindings"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterPolicyBindings that match those selectors. +func (c *clusterPolicyBindings) List(opts meta_v1.ListOptions) (result *v1.ClusterPolicyBindingList, err error) { + result = &v1.ClusterPolicyBindingList{} + err = c.client.Get(). + Resource("clusterpolicybindings"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterPolicyBindings. +func (c *clusterPolicyBindings) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("clusterpolicybindings"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a clusterPolicyBinding and creates it. Returns the server's representation of the clusterPolicyBinding, and an error, if there is any. +func (c *clusterPolicyBindings) Create(clusterPolicyBinding *v1.ClusterPolicyBinding) (result *v1.ClusterPolicyBinding, err error) { + result = &v1.ClusterPolicyBinding{} + err = c.client.Post(). + Resource("clusterpolicybindings"). + Body(clusterPolicyBinding). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterPolicyBinding and updates it. Returns the server's representation of the clusterPolicyBinding, and an error, if there is any. +func (c *clusterPolicyBindings) Update(clusterPolicyBinding *v1.ClusterPolicyBinding) (result *v1.ClusterPolicyBinding, err error) { + result = &v1.ClusterPolicyBinding{} + err = c.client.Put(). + Resource("clusterpolicybindings"). + Name(clusterPolicyBinding.Name). + Body(clusterPolicyBinding). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterPolicyBinding and deletes it. Returns an error if one occurs. +func (c *clusterPolicyBindings) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clusterpolicybindings"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterPolicyBindings) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("clusterpolicybindings"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched clusterPolicyBinding. +func (c *clusterPolicyBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterPolicyBinding, err error) { + result = &v1.ClusterPolicyBinding{} + err = c.client.Patch(pt). + Resource("clusterpolicybindings"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/clusterrole.go b/authorization/clientset/versioned/typed/authorization/v1/clusterrole.go new file mode 100644 index 0000000000..220dab2d16 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/clusterrole.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + scheme "github.com/openshift/client-go/authorization/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ClusterRolesGetter has a method to return a ClusterRoleInterface. +// A group's client should implement this interface. +type ClusterRolesGetter interface { + ClusterRoles() ClusterRoleInterface +} + +// ClusterRoleInterface has methods to work with ClusterRole resources. +type ClusterRoleInterface interface { + Create(*v1.ClusterRole) (*v1.ClusterRole, error) + Update(*v1.ClusterRole) (*v1.ClusterRole, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.ClusterRole, error) + List(opts meta_v1.ListOptions) (*v1.ClusterRoleList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterRole, err error) + ClusterRoleExpansion +} + +// clusterRoles implements ClusterRoleInterface +type clusterRoles struct { + client rest.Interface +} + +// newClusterRoles returns a ClusterRoles +func newClusterRoles(c *AuthorizationV1Client) *clusterRoles { + return &clusterRoles{ + client: c.RESTClient(), + } +} + +// Get takes name of the clusterRole, and returns the corresponding clusterRole object, and an error if there is any. +func (c *clusterRoles) Get(name string, options meta_v1.GetOptions) (result *v1.ClusterRole, err error) { + result = &v1.ClusterRole{} + err = c.client.Get(). + Resource("clusterroles"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterRoles that match those selectors. +func (c *clusterRoles) List(opts meta_v1.ListOptions) (result *v1.ClusterRoleList, err error) { + result = &v1.ClusterRoleList{} + err = c.client.Get(). + Resource("clusterroles"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterRoles. +func (c *clusterRoles) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("clusterroles"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a clusterRole and creates it. Returns the server's representation of the clusterRole, and an error, if there is any. +func (c *clusterRoles) Create(clusterRole *v1.ClusterRole) (result *v1.ClusterRole, err error) { + result = &v1.ClusterRole{} + err = c.client.Post(). + Resource("clusterroles"). + Body(clusterRole). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterRole and updates it. Returns the server's representation of the clusterRole, and an error, if there is any. +func (c *clusterRoles) Update(clusterRole *v1.ClusterRole) (result *v1.ClusterRole, err error) { + result = &v1.ClusterRole{} + err = c.client.Put(). + Resource("clusterroles"). + Name(clusterRole.Name). + Body(clusterRole). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterRole and deletes it. Returns an error if one occurs. +func (c *clusterRoles) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clusterroles"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterRoles) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("clusterroles"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched clusterRole. +func (c *clusterRoles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterRole, err error) { + result = &v1.ClusterRole{} + err = c.client.Patch(pt). + Resource("clusterroles"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/clusterrolebinding.go b/authorization/clientset/versioned/typed/authorization/v1/clusterrolebinding.go new file mode 100644 index 0000000000..ea21ff861f --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/clusterrolebinding.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + scheme "github.com/openshift/client-go/authorization/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ClusterRoleBindingsGetter has a method to return a ClusterRoleBindingInterface. +// A group's client should implement this interface. +type ClusterRoleBindingsGetter interface { + ClusterRoleBindings() ClusterRoleBindingInterface +} + +// ClusterRoleBindingInterface has methods to work with ClusterRoleBinding resources. +type ClusterRoleBindingInterface interface { + Create(*v1.ClusterRoleBinding) (*v1.ClusterRoleBinding, error) + Update(*v1.ClusterRoleBinding) (*v1.ClusterRoleBinding, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.ClusterRoleBinding, error) + List(opts meta_v1.ListOptions) (*v1.ClusterRoleBindingList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterRoleBinding, err error) + ClusterRoleBindingExpansion +} + +// clusterRoleBindings implements ClusterRoleBindingInterface +type clusterRoleBindings struct { + client rest.Interface +} + +// newClusterRoleBindings returns a ClusterRoleBindings +func newClusterRoleBindings(c *AuthorizationV1Client) *clusterRoleBindings { + return &clusterRoleBindings{ + client: c.RESTClient(), + } +} + +// Get takes name of the clusterRoleBinding, and returns the corresponding clusterRoleBinding object, and an error if there is any. +func (c *clusterRoleBindings) Get(name string, options meta_v1.GetOptions) (result *v1.ClusterRoleBinding, err error) { + result = &v1.ClusterRoleBinding{} + err = c.client.Get(). + Resource("clusterrolebindings"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterRoleBindings that match those selectors. +func (c *clusterRoleBindings) List(opts meta_v1.ListOptions) (result *v1.ClusterRoleBindingList, err error) { + result = &v1.ClusterRoleBindingList{} + err = c.client.Get(). + Resource("clusterrolebindings"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterRoleBindings. +func (c *clusterRoleBindings) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("clusterrolebindings"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a clusterRoleBinding and creates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any. +func (c *clusterRoleBindings) Create(clusterRoleBinding *v1.ClusterRoleBinding) (result *v1.ClusterRoleBinding, err error) { + result = &v1.ClusterRoleBinding{} + err = c.client.Post(). + Resource("clusterrolebindings"). + Body(clusterRoleBinding). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterRoleBinding and updates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any. +func (c *clusterRoleBindings) Update(clusterRoleBinding *v1.ClusterRoleBinding) (result *v1.ClusterRoleBinding, err error) { + result = &v1.ClusterRoleBinding{} + err = c.client.Put(). + Resource("clusterrolebindings"). + Name(clusterRoleBinding.Name). + Body(clusterRoleBinding). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterRoleBinding and deletes it. Returns an error if one occurs. +func (c *clusterRoleBindings) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clusterrolebindings"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterRoleBindings) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("clusterrolebindings"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched clusterRoleBinding. +func (c *clusterRoleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterRoleBinding, err error) { + result = &v1.ClusterRoleBinding{} + err = c.client.Patch(pt). + Resource("clusterrolebindings"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/doc.go b/authorization/clientset/versioned/typed/authorization/v1/doc.go new file mode 100644 index 0000000000..0e93c2c5e7 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated typed clients. +package v1 diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/doc.go b/authorization/clientset/versioned/typed/authorization/v1/fake/doc.go new file mode 100644 index 0000000000..e3bbd12a2b --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// Package fake has the automatically generated clients. +package fake diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_authorization_client.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_authorization_client.go new file mode 100644 index 0000000000..32df7b6f18 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_authorization_client.go @@ -0,0 +1,78 @@ +package fake + +import ( + v1 "github.com/openshift/client-go/authorization/clientset/versioned/typed/authorization/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeAuthorizationV1 struct { + *testing.Fake +} + +func (c *FakeAuthorizationV1) ClusterPolicies() v1.ClusterPolicyInterface { + return &FakeClusterPolicies{c} +} + +func (c *FakeAuthorizationV1) ClusterPolicyBindings() v1.ClusterPolicyBindingInterface { + return &FakeClusterPolicyBindings{c} +} + +func (c *FakeAuthorizationV1) ClusterRoles() v1.ClusterRoleInterface { + return &FakeClusterRoles{c} +} + +func (c *FakeAuthorizationV1) ClusterRoleBindings() v1.ClusterRoleBindingInterface { + return &FakeClusterRoleBindings{c} +} + +func (c *FakeAuthorizationV1) LocalResourceAccessReviews(namespace string) v1.LocalResourceAccessReviewInterface { + return &FakeLocalResourceAccessReviews{c, namespace} +} + +func (c *FakeAuthorizationV1) LocalSubjectAccessReviews(namespace string) v1.LocalSubjectAccessReviewInterface { + return &FakeLocalSubjectAccessReviews{c, namespace} +} + +func (c *FakeAuthorizationV1) Policies(namespace string) v1.PolicyInterface { + return &FakePolicies{c, namespace} +} + +func (c *FakeAuthorizationV1) PolicyBindings(namespace string) v1.PolicyBindingInterface { + return &FakePolicyBindings{c, namespace} +} + +func (c *FakeAuthorizationV1) ResourceAccessReviews() v1.ResourceAccessReviewInterface { + return &FakeResourceAccessReviews{c} +} + +func (c *FakeAuthorizationV1) Roles(namespace string) v1.RoleInterface { + return &FakeRoles{c, namespace} +} + +func (c *FakeAuthorizationV1) RoleBindings(namespace string) v1.RoleBindingInterface { + return &FakeRoleBindings{c, namespace} +} + +func (c *FakeAuthorizationV1) RoleBindingRestrictions(namespace string) v1.RoleBindingRestrictionInterface { + return &FakeRoleBindingRestrictions{c, namespace} +} + +func (c *FakeAuthorizationV1) SelfSubjectRulesReviews(namespace string) v1.SelfSubjectRulesReviewInterface { + return &FakeSelfSubjectRulesReviews{c, namespace} +} + +func (c *FakeAuthorizationV1) SubjectAccessReviews() v1.SubjectAccessReviewInterface { + return &FakeSubjectAccessReviews{c} +} + +func (c *FakeAuthorizationV1) SubjectRulesReviews(namespace string) v1.SubjectRulesReviewInterface { + return &FakeSubjectRulesReviews{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAuthorizationV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterpolicy.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterpolicy.go new file mode 100644 index 0000000000..46fa6f2b60 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterpolicy.go @@ -0,0 +1,102 @@ +package fake + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeClusterPolicies implements ClusterPolicyInterface +type FakeClusterPolicies struct { + Fake *FakeAuthorizationV1 +} + +var clusterpoliciesResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "clusterpolicies"} + +var clusterpoliciesKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "ClusterPolicy"} + +// Get takes name of the clusterPolicy, and returns the corresponding clusterPolicy object, and an error if there is any. +func (c *FakeClusterPolicies) Get(name string, options v1.GetOptions) (result *authorization_v1.ClusterPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clusterpoliciesResource, name), &authorization_v1.ClusterPolicy{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterPolicy), err +} + +// List takes label and field selectors, and returns the list of ClusterPolicies that match those selectors. +func (c *FakeClusterPolicies) List(opts v1.ListOptions) (result *authorization_v1.ClusterPolicyList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clusterpoliciesResource, clusterpoliciesKind, opts), &authorization_v1.ClusterPolicyList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &authorization_v1.ClusterPolicyList{} + for _, item := range obj.(*authorization_v1.ClusterPolicyList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterPolicies. +func (c *FakeClusterPolicies) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clusterpoliciesResource, opts)) +} + +// Create takes the representation of a clusterPolicy and creates it. Returns the server's representation of the clusterPolicy, and an error, if there is any. +func (c *FakeClusterPolicies) Create(clusterPolicy *authorization_v1.ClusterPolicy) (result *authorization_v1.ClusterPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clusterpoliciesResource, clusterPolicy), &authorization_v1.ClusterPolicy{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterPolicy), err +} + +// Update takes the representation of a clusterPolicy and updates it. Returns the server's representation of the clusterPolicy, and an error, if there is any. +func (c *FakeClusterPolicies) Update(clusterPolicy *authorization_v1.ClusterPolicy) (result *authorization_v1.ClusterPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clusterpoliciesResource, clusterPolicy), &authorization_v1.ClusterPolicy{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterPolicy), err +} + +// Delete takes name of the clusterPolicy and deletes it. Returns an error if one occurs. +func (c *FakeClusterPolicies) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(clusterpoliciesResource, name), &authorization_v1.ClusterPolicy{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterPolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clusterpoliciesResource, listOptions) + + _, err := c.Fake.Invokes(action, &authorization_v1.ClusterPolicyList{}) + return err +} + +// Patch applies the patch and returns the patched clusterPolicy. +func (c *FakeClusterPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *authorization_v1.ClusterPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusterpoliciesResource, name, data, subresources...), &authorization_v1.ClusterPolicy{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterPolicy), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterpolicybinding.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterpolicybinding.go new file mode 100644 index 0000000000..c25eacb756 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterpolicybinding.go @@ -0,0 +1,102 @@ +package fake + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeClusterPolicyBindings implements ClusterPolicyBindingInterface +type FakeClusterPolicyBindings struct { + Fake *FakeAuthorizationV1 +} + +var clusterpolicybindingsResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "clusterpolicybindings"} + +var clusterpolicybindingsKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "ClusterPolicyBinding"} + +// Get takes name of the clusterPolicyBinding, and returns the corresponding clusterPolicyBinding object, and an error if there is any. +func (c *FakeClusterPolicyBindings) Get(name string, options v1.GetOptions) (result *authorization_v1.ClusterPolicyBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clusterpolicybindingsResource, name), &authorization_v1.ClusterPolicyBinding{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterPolicyBinding), err +} + +// List takes label and field selectors, and returns the list of ClusterPolicyBindings that match those selectors. +func (c *FakeClusterPolicyBindings) List(opts v1.ListOptions) (result *authorization_v1.ClusterPolicyBindingList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clusterpolicybindingsResource, clusterpolicybindingsKind, opts), &authorization_v1.ClusterPolicyBindingList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &authorization_v1.ClusterPolicyBindingList{} + for _, item := range obj.(*authorization_v1.ClusterPolicyBindingList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterPolicyBindings. +func (c *FakeClusterPolicyBindings) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clusterpolicybindingsResource, opts)) +} + +// Create takes the representation of a clusterPolicyBinding and creates it. Returns the server's representation of the clusterPolicyBinding, and an error, if there is any. +func (c *FakeClusterPolicyBindings) Create(clusterPolicyBinding *authorization_v1.ClusterPolicyBinding) (result *authorization_v1.ClusterPolicyBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clusterpolicybindingsResource, clusterPolicyBinding), &authorization_v1.ClusterPolicyBinding{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterPolicyBinding), err +} + +// Update takes the representation of a clusterPolicyBinding and updates it. Returns the server's representation of the clusterPolicyBinding, and an error, if there is any. +func (c *FakeClusterPolicyBindings) Update(clusterPolicyBinding *authorization_v1.ClusterPolicyBinding) (result *authorization_v1.ClusterPolicyBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clusterpolicybindingsResource, clusterPolicyBinding), &authorization_v1.ClusterPolicyBinding{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterPolicyBinding), err +} + +// Delete takes name of the clusterPolicyBinding and deletes it. Returns an error if one occurs. +func (c *FakeClusterPolicyBindings) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(clusterpolicybindingsResource, name), &authorization_v1.ClusterPolicyBinding{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterPolicyBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clusterpolicybindingsResource, listOptions) + + _, err := c.Fake.Invokes(action, &authorization_v1.ClusterPolicyBindingList{}) + return err +} + +// Patch applies the patch and returns the patched clusterPolicyBinding. +func (c *FakeClusterPolicyBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *authorization_v1.ClusterPolicyBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusterpolicybindingsResource, name, data, subresources...), &authorization_v1.ClusterPolicyBinding{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterPolicyBinding), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterrole.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterrole.go new file mode 100644 index 0000000000..d3f606402c --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterrole.go @@ -0,0 +1,102 @@ +package fake + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeClusterRoles implements ClusterRoleInterface +type FakeClusterRoles struct { + Fake *FakeAuthorizationV1 +} + +var clusterrolesResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "clusterroles"} + +var clusterrolesKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "ClusterRole"} + +// Get takes name of the clusterRole, and returns the corresponding clusterRole object, and an error if there is any. +func (c *FakeClusterRoles) Get(name string, options v1.GetOptions) (result *authorization_v1.ClusterRole, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clusterrolesResource, name), &authorization_v1.ClusterRole{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterRole), err +} + +// List takes label and field selectors, and returns the list of ClusterRoles that match those selectors. +func (c *FakeClusterRoles) List(opts v1.ListOptions) (result *authorization_v1.ClusterRoleList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clusterrolesResource, clusterrolesKind, opts), &authorization_v1.ClusterRoleList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &authorization_v1.ClusterRoleList{} + for _, item := range obj.(*authorization_v1.ClusterRoleList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterRoles. +func (c *FakeClusterRoles) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clusterrolesResource, opts)) +} + +// Create takes the representation of a clusterRole and creates it. Returns the server's representation of the clusterRole, and an error, if there is any. +func (c *FakeClusterRoles) Create(clusterRole *authorization_v1.ClusterRole) (result *authorization_v1.ClusterRole, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clusterrolesResource, clusterRole), &authorization_v1.ClusterRole{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterRole), err +} + +// Update takes the representation of a clusterRole and updates it. Returns the server's representation of the clusterRole, and an error, if there is any. +func (c *FakeClusterRoles) Update(clusterRole *authorization_v1.ClusterRole) (result *authorization_v1.ClusterRole, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clusterrolesResource, clusterRole), &authorization_v1.ClusterRole{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterRole), err +} + +// Delete takes name of the clusterRole and deletes it. Returns an error if one occurs. +func (c *FakeClusterRoles) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(clusterrolesResource, name), &authorization_v1.ClusterRole{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterRoles) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clusterrolesResource, listOptions) + + _, err := c.Fake.Invokes(action, &authorization_v1.ClusterRoleList{}) + return err +} + +// Patch applies the patch and returns the patched clusterRole. +func (c *FakeClusterRoles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *authorization_v1.ClusterRole, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusterrolesResource, name, data, subresources...), &authorization_v1.ClusterRole{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterRole), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterrolebinding.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterrolebinding.go new file mode 100644 index 0000000000..d5b5cd6337 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_clusterrolebinding.go @@ -0,0 +1,102 @@ +package fake + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeClusterRoleBindings implements ClusterRoleBindingInterface +type FakeClusterRoleBindings struct { + Fake *FakeAuthorizationV1 +} + +var clusterrolebindingsResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "clusterrolebindings"} + +var clusterrolebindingsKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "ClusterRoleBinding"} + +// Get takes name of the clusterRoleBinding, and returns the corresponding clusterRoleBinding object, and an error if there is any. +func (c *FakeClusterRoleBindings) Get(name string, options v1.GetOptions) (result *authorization_v1.ClusterRoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clusterrolebindingsResource, name), &authorization_v1.ClusterRoleBinding{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterRoleBinding), err +} + +// List takes label and field selectors, and returns the list of ClusterRoleBindings that match those selectors. +func (c *FakeClusterRoleBindings) List(opts v1.ListOptions) (result *authorization_v1.ClusterRoleBindingList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clusterrolebindingsResource, clusterrolebindingsKind, opts), &authorization_v1.ClusterRoleBindingList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &authorization_v1.ClusterRoleBindingList{} + for _, item := range obj.(*authorization_v1.ClusterRoleBindingList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterRoleBindings. +func (c *FakeClusterRoleBindings) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clusterrolebindingsResource, opts)) +} + +// Create takes the representation of a clusterRoleBinding and creates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any. +func (c *FakeClusterRoleBindings) Create(clusterRoleBinding *authorization_v1.ClusterRoleBinding) (result *authorization_v1.ClusterRoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clusterrolebindingsResource, clusterRoleBinding), &authorization_v1.ClusterRoleBinding{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterRoleBinding), err +} + +// Update takes the representation of a clusterRoleBinding and updates it. Returns the server's representation of the clusterRoleBinding, and an error, if there is any. +func (c *FakeClusterRoleBindings) Update(clusterRoleBinding *authorization_v1.ClusterRoleBinding) (result *authorization_v1.ClusterRoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clusterrolebindingsResource, clusterRoleBinding), &authorization_v1.ClusterRoleBinding{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterRoleBinding), err +} + +// Delete takes name of the clusterRoleBinding and deletes it. Returns an error if one occurs. +func (c *FakeClusterRoleBindings) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(clusterrolebindingsResource, name), &authorization_v1.ClusterRoleBinding{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterRoleBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clusterrolebindingsResource, listOptions) + + _, err := c.Fake.Invokes(action, &authorization_v1.ClusterRoleBindingList{}) + return err +} + +// Patch applies the patch and returns the patched clusterRoleBinding. +func (c *FakeClusterRoleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *authorization_v1.ClusterRoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusterrolebindingsResource, name, data, subresources...), &authorization_v1.ClusterRoleBinding{}) + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.ClusterRoleBinding), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_localresourceaccessreview.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_localresourceaccessreview.go new file mode 100644 index 0000000000..a44049727b --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_localresourceaccessreview.go @@ -0,0 +1,28 @@ +package fake + +import ( + v1 "github.com/openshift/api/authorization/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeLocalResourceAccessReviews implements LocalResourceAccessReviewInterface +type FakeLocalResourceAccessReviews struct { + Fake *FakeAuthorizationV1 + ns string +} + +var localresourceaccessreviewsResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "localresourceaccessreviews"} + +var localresourceaccessreviewsKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "LocalResourceAccessReview"} + +// Create takes the representation of a localResourceAccessReview and creates it. Returns the server's representation of the resourceAccessReviewResponse, and an error, if there is any. +func (c *FakeLocalResourceAccessReviews) Create(localResourceAccessReview *v1.LocalResourceAccessReview) (result *v1.ResourceAccessReviewResponse, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(localresourceaccessreviewsResource, c.ns, localResourceAccessReview), &v1.ResourceAccessReviewResponse{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceAccessReviewResponse), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_localsubjectaccessreview.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_localsubjectaccessreview.go new file mode 100644 index 0000000000..8aa9a32d68 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_localsubjectaccessreview.go @@ -0,0 +1,28 @@ +package fake + +import ( + v1 "github.com/openshift/api/authorization/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeLocalSubjectAccessReviews implements LocalSubjectAccessReviewInterface +type FakeLocalSubjectAccessReviews struct { + Fake *FakeAuthorizationV1 + ns string +} + +var localsubjectaccessreviewsResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "localsubjectaccessreviews"} + +var localsubjectaccessreviewsKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "LocalSubjectAccessReview"} + +// Create takes the representation of a localSubjectAccessReview and creates it. Returns the server's representation of the subjectAccessReviewResponse, and an error, if there is any. +func (c *FakeLocalSubjectAccessReviews) Create(localSubjectAccessReview *v1.LocalSubjectAccessReview) (result *v1.SubjectAccessReviewResponse, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(localsubjectaccessreviewsResource, c.ns, localSubjectAccessReview), &v1.SubjectAccessReviewResponse{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.SubjectAccessReviewResponse), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_policy.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_policy.go new file mode 100644 index 0000000000..3e89b72b37 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_policy.go @@ -0,0 +1,110 @@ +package fake + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePolicies implements PolicyInterface +type FakePolicies struct { + Fake *FakeAuthorizationV1 + ns string +} + +var policiesResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "policies"} + +var policiesKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "Policy"} + +// Get takes name of the policy, and returns the corresponding policy object, and an error if there is any. +func (c *FakePolicies) Get(name string, options v1.GetOptions) (result *authorization_v1.Policy, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(policiesResource, c.ns, name), &authorization_v1.Policy{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.Policy), err +} + +// List takes label and field selectors, and returns the list of Policies that match those selectors. +func (c *FakePolicies) List(opts v1.ListOptions) (result *authorization_v1.PolicyList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(policiesResource, policiesKind, c.ns, opts), &authorization_v1.PolicyList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &authorization_v1.PolicyList{} + for _, item := range obj.(*authorization_v1.PolicyList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested policies. +func (c *FakePolicies) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(policiesResource, c.ns, opts)) + +} + +// Create takes the representation of a policy and creates it. Returns the server's representation of the policy, and an error, if there is any. +func (c *FakePolicies) Create(policy *authorization_v1.Policy) (result *authorization_v1.Policy, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(policiesResource, c.ns, policy), &authorization_v1.Policy{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.Policy), err +} + +// Update takes the representation of a policy and updates it. Returns the server's representation of the policy, and an error, if there is any. +func (c *FakePolicies) Update(policy *authorization_v1.Policy) (result *authorization_v1.Policy, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(policiesResource, c.ns, policy), &authorization_v1.Policy{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.Policy), err +} + +// Delete takes name of the policy and deletes it. Returns an error if one occurs. +func (c *FakePolicies) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(policiesResource, c.ns, name), &authorization_v1.Policy{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(policiesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &authorization_v1.PolicyList{}) + return err +} + +// Patch applies the patch and returns the patched policy. +func (c *FakePolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *authorization_v1.Policy, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(policiesResource, c.ns, name, data, subresources...), &authorization_v1.Policy{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.Policy), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_policybinding.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_policybinding.go new file mode 100644 index 0000000000..3d9547a18c --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_policybinding.go @@ -0,0 +1,110 @@ +package fake + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePolicyBindings implements PolicyBindingInterface +type FakePolicyBindings struct { + Fake *FakeAuthorizationV1 + ns string +} + +var policybindingsResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "policybindings"} + +var policybindingsKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "PolicyBinding"} + +// Get takes name of the policyBinding, and returns the corresponding policyBinding object, and an error if there is any. +func (c *FakePolicyBindings) Get(name string, options v1.GetOptions) (result *authorization_v1.PolicyBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(policybindingsResource, c.ns, name), &authorization_v1.PolicyBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.PolicyBinding), err +} + +// List takes label and field selectors, and returns the list of PolicyBindings that match those selectors. +func (c *FakePolicyBindings) List(opts v1.ListOptions) (result *authorization_v1.PolicyBindingList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(policybindingsResource, policybindingsKind, c.ns, opts), &authorization_v1.PolicyBindingList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &authorization_v1.PolicyBindingList{} + for _, item := range obj.(*authorization_v1.PolicyBindingList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested policyBindings. +func (c *FakePolicyBindings) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(policybindingsResource, c.ns, opts)) + +} + +// Create takes the representation of a policyBinding and creates it. Returns the server's representation of the policyBinding, and an error, if there is any. +func (c *FakePolicyBindings) Create(policyBinding *authorization_v1.PolicyBinding) (result *authorization_v1.PolicyBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(policybindingsResource, c.ns, policyBinding), &authorization_v1.PolicyBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.PolicyBinding), err +} + +// Update takes the representation of a policyBinding and updates it. Returns the server's representation of the policyBinding, and an error, if there is any. +func (c *FakePolicyBindings) Update(policyBinding *authorization_v1.PolicyBinding) (result *authorization_v1.PolicyBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(policybindingsResource, c.ns, policyBinding), &authorization_v1.PolicyBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.PolicyBinding), err +} + +// Delete takes name of the policyBinding and deletes it. Returns an error if one occurs. +func (c *FakePolicyBindings) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(policybindingsResource, c.ns, name), &authorization_v1.PolicyBinding{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePolicyBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(policybindingsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &authorization_v1.PolicyBindingList{}) + return err +} + +// Patch applies the patch and returns the patched policyBinding. +func (c *FakePolicyBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *authorization_v1.PolicyBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(policybindingsResource, c.ns, name, data, subresources...), &authorization_v1.PolicyBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.PolicyBinding), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_resourceaccessreview.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_resourceaccessreview.go new file mode 100644 index 0000000000..6df212f8ad --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_resourceaccessreview.go @@ -0,0 +1,26 @@ +package fake + +import ( + v1 "github.com/openshift/api/authorization/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeResourceAccessReviews implements ResourceAccessReviewInterface +type FakeResourceAccessReviews struct { + Fake *FakeAuthorizationV1 +} + +var resourceaccessreviewsResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "resourceaccessreviews"} + +var resourceaccessreviewsKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "ResourceAccessReview"} + +// Create takes the representation of a resourceAccessReview and creates it. Returns the server's representation of the resourceAccessReviewResponse, and an error, if there is any. +func (c *FakeResourceAccessReviews) Create(resourceAccessReview *v1.ResourceAccessReview) (result *v1.ResourceAccessReviewResponse, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(resourceaccessreviewsResource, resourceAccessReview), &v1.ResourceAccessReviewResponse{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ResourceAccessReviewResponse), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_role.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_role.go new file mode 100644 index 0000000000..64554a16fb --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_role.go @@ -0,0 +1,110 @@ +package fake + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeRoles implements RoleInterface +type FakeRoles struct { + Fake *FakeAuthorizationV1 + ns string +} + +var rolesResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "roles"} + +var rolesKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "Role"} + +// Get takes name of the role, and returns the corresponding role object, and an error if there is any. +func (c *FakeRoles) Get(name string, options v1.GetOptions) (result *authorization_v1.Role, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(rolesResource, c.ns, name), &authorization_v1.Role{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.Role), err +} + +// List takes label and field selectors, and returns the list of Roles that match those selectors. +func (c *FakeRoles) List(opts v1.ListOptions) (result *authorization_v1.RoleList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(rolesResource, rolesKind, c.ns, opts), &authorization_v1.RoleList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &authorization_v1.RoleList{} + for _, item := range obj.(*authorization_v1.RoleList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested roles. +func (c *FakeRoles) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(rolesResource, c.ns, opts)) + +} + +// Create takes the representation of a role and creates it. Returns the server's representation of the role, and an error, if there is any. +func (c *FakeRoles) Create(role *authorization_v1.Role) (result *authorization_v1.Role, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(rolesResource, c.ns, role), &authorization_v1.Role{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.Role), err +} + +// Update takes the representation of a role and updates it. Returns the server's representation of the role, and an error, if there is any. +func (c *FakeRoles) Update(role *authorization_v1.Role) (result *authorization_v1.Role, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(rolesResource, c.ns, role), &authorization_v1.Role{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.Role), err +} + +// Delete takes name of the role and deletes it. Returns an error if one occurs. +func (c *FakeRoles) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(rolesResource, c.ns, name), &authorization_v1.Role{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeRoles) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(rolesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &authorization_v1.RoleList{}) + return err +} + +// Patch applies the patch and returns the patched role. +func (c *FakeRoles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *authorization_v1.Role, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rolesResource, c.ns, name, data, subresources...), &authorization_v1.Role{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.Role), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_rolebinding.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_rolebinding.go new file mode 100644 index 0000000000..cfe45d3359 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_rolebinding.go @@ -0,0 +1,110 @@ +package fake + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeRoleBindings implements RoleBindingInterface +type FakeRoleBindings struct { + Fake *FakeAuthorizationV1 + ns string +} + +var rolebindingsResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "rolebindings"} + +var rolebindingsKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "RoleBinding"} + +// Get takes name of the roleBinding, and returns the corresponding roleBinding object, and an error if there is any. +func (c *FakeRoleBindings) Get(name string, options v1.GetOptions) (result *authorization_v1.RoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(rolebindingsResource, c.ns, name), &authorization_v1.RoleBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.RoleBinding), err +} + +// List takes label and field selectors, and returns the list of RoleBindings that match those selectors. +func (c *FakeRoleBindings) List(opts v1.ListOptions) (result *authorization_v1.RoleBindingList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(rolebindingsResource, rolebindingsKind, c.ns, opts), &authorization_v1.RoleBindingList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &authorization_v1.RoleBindingList{} + for _, item := range obj.(*authorization_v1.RoleBindingList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested roleBindings. +func (c *FakeRoleBindings) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(rolebindingsResource, c.ns, opts)) + +} + +// Create takes the representation of a roleBinding and creates it. Returns the server's representation of the roleBinding, and an error, if there is any. +func (c *FakeRoleBindings) Create(roleBinding *authorization_v1.RoleBinding) (result *authorization_v1.RoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(rolebindingsResource, c.ns, roleBinding), &authorization_v1.RoleBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.RoleBinding), err +} + +// Update takes the representation of a roleBinding and updates it. Returns the server's representation of the roleBinding, and an error, if there is any. +func (c *FakeRoleBindings) Update(roleBinding *authorization_v1.RoleBinding) (result *authorization_v1.RoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(rolebindingsResource, c.ns, roleBinding), &authorization_v1.RoleBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.RoleBinding), err +} + +// Delete takes name of the roleBinding and deletes it. Returns an error if one occurs. +func (c *FakeRoleBindings) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(rolebindingsResource, c.ns, name), &authorization_v1.RoleBinding{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeRoleBindings) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(rolebindingsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &authorization_v1.RoleBindingList{}) + return err +} + +// Patch applies the patch and returns the patched roleBinding. +func (c *FakeRoleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *authorization_v1.RoleBinding, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rolebindingsResource, c.ns, name, data, subresources...), &authorization_v1.RoleBinding{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.RoleBinding), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_rolebindingrestriction.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_rolebindingrestriction.go new file mode 100644 index 0000000000..af0af695e4 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_rolebindingrestriction.go @@ -0,0 +1,110 @@ +package fake + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeRoleBindingRestrictions implements RoleBindingRestrictionInterface +type FakeRoleBindingRestrictions struct { + Fake *FakeAuthorizationV1 + ns string +} + +var rolebindingrestrictionsResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "rolebindingrestrictions"} + +var rolebindingrestrictionsKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "RoleBindingRestriction"} + +// Get takes name of the roleBindingRestriction, and returns the corresponding roleBindingRestriction object, and an error if there is any. +func (c *FakeRoleBindingRestrictions) Get(name string, options v1.GetOptions) (result *authorization_v1.RoleBindingRestriction, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(rolebindingrestrictionsResource, c.ns, name), &authorization_v1.RoleBindingRestriction{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.RoleBindingRestriction), err +} + +// List takes label and field selectors, and returns the list of RoleBindingRestrictions that match those selectors. +func (c *FakeRoleBindingRestrictions) List(opts v1.ListOptions) (result *authorization_v1.RoleBindingRestrictionList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(rolebindingrestrictionsResource, rolebindingrestrictionsKind, c.ns, opts), &authorization_v1.RoleBindingRestrictionList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &authorization_v1.RoleBindingRestrictionList{} + for _, item := range obj.(*authorization_v1.RoleBindingRestrictionList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested roleBindingRestrictions. +func (c *FakeRoleBindingRestrictions) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(rolebindingrestrictionsResource, c.ns, opts)) + +} + +// Create takes the representation of a roleBindingRestriction and creates it. Returns the server's representation of the roleBindingRestriction, and an error, if there is any. +func (c *FakeRoleBindingRestrictions) Create(roleBindingRestriction *authorization_v1.RoleBindingRestriction) (result *authorization_v1.RoleBindingRestriction, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(rolebindingrestrictionsResource, c.ns, roleBindingRestriction), &authorization_v1.RoleBindingRestriction{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.RoleBindingRestriction), err +} + +// Update takes the representation of a roleBindingRestriction and updates it. Returns the server's representation of the roleBindingRestriction, and an error, if there is any. +func (c *FakeRoleBindingRestrictions) Update(roleBindingRestriction *authorization_v1.RoleBindingRestriction) (result *authorization_v1.RoleBindingRestriction, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(rolebindingrestrictionsResource, c.ns, roleBindingRestriction), &authorization_v1.RoleBindingRestriction{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.RoleBindingRestriction), err +} + +// Delete takes name of the roleBindingRestriction and deletes it. Returns an error if one occurs. +func (c *FakeRoleBindingRestrictions) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(rolebindingrestrictionsResource, c.ns, name), &authorization_v1.RoleBindingRestriction{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeRoleBindingRestrictions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(rolebindingrestrictionsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &authorization_v1.RoleBindingRestrictionList{}) + return err +} + +// Patch applies the patch and returns the patched roleBindingRestriction. +func (c *FakeRoleBindingRestrictions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *authorization_v1.RoleBindingRestriction, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(rolebindingrestrictionsResource, c.ns, name, data, subresources...), &authorization_v1.RoleBindingRestriction{}) + + if obj == nil { + return nil, err + } + return obj.(*authorization_v1.RoleBindingRestriction), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_selfsubjectrulesreview.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_selfsubjectrulesreview.go new file mode 100644 index 0000000000..5b30ee8019 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_selfsubjectrulesreview.go @@ -0,0 +1,28 @@ +package fake + +import ( + v1 "github.com/openshift/api/authorization/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeSelfSubjectRulesReviews implements SelfSubjectRulesReviewInterface +type FakeSelfSubjectRulesReviews struct { + Fake *FakeAuthorizationV1 + ns string +} + +var selfsubjectrulesreviewsResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "selfsubjectrulesreviews"} + +var selfsubjectrulesreviewsKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "SelfSubjectRulesReview"} + +// Create takes the representation of a selfSubjectRulesReview and creates it. Returns the server's representation of the selfSubjectRulesReview, and an error, if there is any. +func (c *FakeSelfSubjectRulesReviews) Create(selfSubjectRulesReview *v1.SelfSubjectRulesReview) (result *v1.SelfSubjectRulesReview, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(selfsubjectrulesreviewsResource, c.ns, selfSubjectRulesReview), &v1.SelfSubjectRulesReview{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.SelfSubjectRulesReview), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_subjectaccessreview.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_subjectaccessreview.go new file mode 100644 index 0000000000..cb8e076581 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_subjectaccessreview.go @@ -0,0 +1,26 @@ +package fake + +import ( + v1 "github.com/openshift/api/authorization/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeSubjectAccessReviews implements SubjectAccessReviewInterface +type FakeSubjectAccessReviews struct { + Fake *FakeAuthorizationV1 +} + +var subjectaccessreviewsResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "subjectaccessreviews"} + +var subjectaccessreviewsKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "SubjectAccessReview"} + +// Create takes the representation of a subjectAccessReview and creates it. Returns the server's representation of the subjectAccessReviewResponse, and an error, if there is any. +func (c *FakeSubjectAccessReviews) Create(subjectAccessReview *v1.SubjectAccessReview) (result *v1.SubjectAccessReviewResponse, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(subjectaccessreviewsResource, subjectAccessReview), &v1.SubjectAccessReviewResponse{}) + if obj == nil { + return nil, err + } + return obj.(*v1.SubjectAccessReviewResponse), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/fake/fake_subjectrulesreview.go b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_subjectrulesreview.go new file mode 100644 index 0000000000..84c82d4404 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/fake/fake_subjectrulesreview.go @@ -0,0 +1,28 @@ +package fake + +import ( + v1 "github.com/openshift/api/authorization/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeSubjectRulesReviews implements SubjectRulesReviewInterface +type FakeSubjectRulesReviews struct { + Fake *FakeAuthorizationV1 + ns string +} + +var subjectrulesreviewsResource = schema.GroupVersionResource{Group: "authorization.openshift.io", Version: "v1", Resource: "subjectrulesreviews"} + +var subjectrulesreviewsKind = schema.GroupVersionKind{Group: "authorization.openshift.io", Version: "v1", Kind: "SubjectRulesReview"} + +// Create takes the representation of a subjectRulesReview and creates it. Returns the server's representation of the subjectRulesReview, and an error, if there is any. +func (c *FakeSubjectRulesReviews) Create(subjectRulesReview *v1.SubjectRulesReview) (result *v1.SubjectRulesReview, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(subjectrulesreviewsResource, c.ns, subjectRulesReview), &v1.SubjectRulesReview{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.SubjectRulesReview), err +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/generated_expansion.go b/authorization/clientset/versioned/typed/authorization/v1/generated_expansion.go new file mode 100644 index 0000000000..066f71c800 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/generated_expansion.go @@ -0,0 +1,31 @@ +package v1 + +type ClusterPolicyExpansion interface{} + +type ClusterPolicyBindingExpansion interface{} + +type ClusterRoleExpansion interface{} + +type ClusterRoleBindingExpansion interface{} + +type LocalResourceAccessReviewExpansion interface{} + +type LocalSubjectAccessReviewExpansion interface{} + +type PolicyExpansion interface{} + +type PolicyBindingExpansion interface{} + +type ResourceAccessReviewExpansion interface{} + +type RoleExpansion interface{} + +type RoleBindingExpansion interface{} + +type RoleBindingRestrictionExpansion interface{} + +type SelfSubjectRulesReviewExpansion interface{} + +type SubjectAccessReviewExpansion interface{} + +type SubjectRulesReviewExpansion interface{} diff --git a/authorization/clientset/versioned/typed/authorization/v1/localresourceaccessreview.go b/authorization/clientset/versioned/typed/authorization/v1/localresourceaccessreview.go new file mode 100644 index 0000000000..84bec73848 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/localresourceaccessreview.go @@ -0,0 +1,45 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + rest "k8s.io/client-go/rest" +) + +// LocalResourceAccessReviewsGetter has a method to return a LocalResourceAccessReviewInterface. +// A group's client should implement this interface. +type LocalResourceAccessReviewsGetter interface { + LocalResourceAccessReviews(namespace string) LocalResourceAccessReviewInterface +} + +// LocalResourceAccessReviewInterface has methods to work with LocalResourceAccessReview resources. +type LocalResourceAccessReviewInterface interface { + Create(*v1.LocalResourceAccessReview) (*v1.ResourceAccessReviewResponse, error) + + LocalResourceAccessReviewExpansion +} + +// localResourceAccessReviews implements LocalResourceAccessReviewInterface +type localResourceAccessReviews struct { + client rest.Interface + ns string +} + +// newLocalResourceAccessReviews returns a LocalResourceAccessReviews +func newLocalResourceAccessReviews(c *AuthorizationV1Client, namespace string) *localResourceAccessReviews { + return &localResourceAccessReviews{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a localResourceAccessReview and creates it. Returns the server's representation of the resourceAccessReviewResponse, and an error, if there is any. +func (c *localResourceAccessReviews) Create(localResourceAccessReview *v1.LocalResourceAccessReview) (result *v1.ResourceAccessReviewResponse, err error) { + result = &v1.ResourceAccessReviewResponse{} + err = c.client.Post(). + Namespace(c.ns). + Resource("localresourceaccessreviews"). + Body(localResourceAccessReview). + Do(). + Into(result) + return +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/localsubjectaccessreview.go b/authorization/clientset/versioned/typed/authorization/v1/localsubjectaccessreview.go new file mode 100644 index 0000000000..e72a4c569e --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/localsubjectaccessreview.go @@ -0,0 +1,45 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + rest "k8s.io/client-go/rest" +) + +// LocalSubjectAccessReviewsGetter has a method to return a LocalSubjectAccessReviewInterface. +// A group's client should implement this interface. +type LocalSubjectAccessReviewsGetter interface { + LocalSubjectAccessReviews(namespace string) LocalSubjectAccessReviewInterface +} + +// LocalSubjectAccessReviewInterface has methods to work with LocalSubjectAccessReview resources. +type LocalSubjectAccessReviewInterface interface { + Create(*v1.LocalSubjectAccessReview) (*v1.SubjectAccessReviewResponse, error) + + LocalSubjectAccessReviewExpansion +} + +// localSubjectAccessReviews implements LocalSubjectAccessReviewInterface +type localSubjectAccessReviews struct { + client rest.Interface + ns string +} + +// newLocalSubjectAccessReviews returns a LocalSubjectAccessReviews +func newLocalSubjectAccessReviews(c *AuthorizationV1Client, namespace string) *localSubjectAccessReviews { + return &localSubjectAccessReviews{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a localSubjectAccessReview and creates it. Returns the server's representation of the subjectAccessReviewResponse, and an error, if there is any. +func (c *localSubjectAccessReviews) Create(localSubjectAccessReview *v1.LocalSubjectAccessReview) (result *v1.SubjectAccessReviewResponse, err error) { + result = &v1.SubjectAccessReviewResponse{} + err = c.client.Post(). + Namespace(c.ns). + Resource("localsubjectaccessreviews"). + Body(localSubjectAccessReview). + Do(). + Into(result) + return +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/policy.go b/authorization/clientset/versioned/typed/authorization/v1/policy.go new file mode 100644 index 0000000000..63ccf7b82f --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/policy.go @@ -0,0 +1,139 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + scheme "github.com/openshift/client-go/authorization/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PoliciesGetter has a method to return a PolicyInterface. +// A group's client should implement this interface. +type PoliciesGetter interface { + Policies(namespace string) PolicyInterface +} + +// PolicyInterface has methods to work with Policy resources. +type PolicyInterface interface { + Create(*v1.Policy) (*v1.Policy, error) + Update(*v1.Policy) (*v1.Policy, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.Policy, error) + List(opts meta_v1.ListOptions) (*v1.PolicyList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Policy, err error) + PolicyExpansion +} + +// policies implements PolicyInterface +type policies struct { + client rest.Interface + ns string +} + +// newPolicies returns a Policies +func newPolicies(c *AuthorizationV1Client, namespace string) *policies { + return &policies{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the policy, and returns the corresponding policy object, and an error if there is any. +func (c *policies) Get(name string, options meta_v1.GetOptions) (result *v1.Policy, err error) { + result = &v1.Policy{} + err = c.client.Get(). + Namespace(c.ns). + Resource("policies"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Policies that match those selectors. +func (c *policies) List(opts meta_v1.ListOptions) (result *v1.PolicyList, err error) { + result = &v1.PolicyList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("policies"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested policies. +func (c *policies) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("policies"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a policy and creates it. Returns the server's representation of the policy, and an error, if there is any. +func (c *policies) Create(policy *v1.Policy) (result *v1.Policy, err error) { + result = &v1.Policy{} + err = c.client.Post(). + Namespace(c.ns). + Resource("policies"). + Body(policy). + Do(). + Into(result) + return +} + +// Update takes the representation of a policy and updates it. Returns the server's representation of the policy, and an error, if there is any. +func (c *policies) Update(policy *v1.Policy) (result *v1.Policy, err error) { + result = &v1.Policy{} + err = c.client.Put(). + Namespace(c.ns). + Resource("policies"). + Name(policy.Name). + Body(policy). + Do(). + Into(result) + return +} + +// Delete takes name of the policy and deletes it. Returns an error if one occurs. +func (c *policies) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("policies"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *policies) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("policies"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched policy. +func (c *policies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Policy, err error) { + result = &v1.Policy{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("policies"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/policybinding.go b/authorization/clientset/versioned/typed/authorization/v1/policybinding.go new file mode 100644 index 0000000000..d90bb3de6f --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/policybinding.go @@ -0,0 +1,139 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + scheme "github.com/openshift/client-go/authorization/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PolicyBindingsGetter has a method to return a PolicyBindingInterface. +// A group's client should implement this interface. +type PolicyBindingsGetter interface { + PolicyBindings(namespace string) PolicyBindingInterface +} + +// PolicyBindingInterface has methods to work with PolicyBinding resources. +type PolicyBindingInterface interface { + Create(*v1.PolicyBinding) (*v1.PolicyBinding, error) + Update(*v1.PolicyBinding) (*v1.PolicyBinding, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.PolicyBinding, error) + List(opts meta_v1.ListOptions) (*v1.PolicyBindingList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.PolicyBinding, err error) + PolicyBindingExpansion +} + +// policyBindings implements PolicyBindingInterface +type policyBindings struct { + client rest.Interface + ns string +} + +// newPolicyBindings returns a PolicyBindings +func newPolicyBindings(c *AuthorizationV1Client, namespace string) *policyBindings { + return &policyBindings{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the policyBinding, and returns the corresponding policyBinding object, and an error if there is any. +func (c *policyBindings) Get(name string, options meta_v1.GetOptions) (result *v1.PolicyBinding, err error) { + result = &v1.PolicyBinding{} + err = c.client.Get(). + Namespace(c.ns). + Resource("policybindings"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PolicyBindings that match those selectors. +func (c *policyBindings) List(opts meta_v1.ListOptions) (result *v1.PolicyBindingList, err error) { + result = &v1.PolicyBindingList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("policybindings"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested policyBindings. +func (c *policyBindings) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("policybindings"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a policyBinding and creates it. Returns the server's representation of the policyBinding, and an error, if there is any. +func (c *policyBindings) Create(policyBinding *v1.PolicyBinding) (result *v1.PolicyBinding, err error) { + result = &v1.PolicyBinding{} + err = c.client.Post(). + Namespace(c.ns). + Resource("policybindings"). + Body(policyBinding). + Do(). + Into(result) + return +} + +// Update takes the representation of a policyBinding and updates it. Returns the server's representation of the policyBinding, and an error, if there is any. +func (c *policyBindings) Update(policyBinding *v1.PolicyBinding) (result *v1.PolicyBinding, err error) { + result = &v1.PolicyBinding{} + err = c.client.Put(). + Namespace(c.ns). + Resource("policybindings"). + Name(policyBinding.Name). + Body(policyBinding). + Do(). + Into(result) + return +} + +// Delete takes name of the policyBinding and deletes it. Returns an error if one occurs. +func (c *policyBindings) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("policybindings"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *policyBindings) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("policybindings"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched policyBinding. +func (c *policyBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.PolicyBinding, err error) { + result = &v1.PolicyBinding{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("policybindings"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/resourceaccessreview.go b/authorization/clientset/versioned/typed/authorization/v1/resourceaccessreview.go new file mode 100644 index 0000000000..456b0236c1 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/resourceaccessreview.go @@ -0,0 +1,42 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + rest "k8s.io/client-go/rest" +) + +// ResourceAccessReviewsGetter has a method to return a ResourceAccessReviewInterface. +// A group's client should implement this interface. +type ResourceAccessReviewsGetter interface { + ResourceAccessReviews() ResourceAccessReviewInterface +} + +// ResourceAccessReviewInterface has methods to work with ResourceAccessReview resources. +type ResourceAccessReviewInterface interface { + Create(*v1.ResourceAccessReview) (*v1.ResourceAccessReviewResponse, error) + + ResourceAccessReviewExpansion +} + +// resourceAccessReviews implements ResourceAccessReviewInterface +type resourceAccessReviews struct { + client rest.Interface +} + +// newResourceAccessReviews returns a ResourceAccessReviews +func newResourceAccessReviews(c *AuthorizationV1Client) *resourceAccessReviews { + return &resourceAccessReviews{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a resourceAccessReview and creates it. Returns the server's representation of the resourceAccessReviewResponse, and an error, if there is any. +func (c *resourceAccessReviews) Create(resourceAccessReview *v1.ResourceAccessReview) (result *v1.ResourceAccessReviewResponse, err error) { + result = &v1.ResourceAccessReviewResponse{} + err = c.client.Post(). + Resource("resourceaccessreviews"). + Body(resourceAccessReview). + Do(). + Into(result) + return +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/role.go b/authorization/clientset/versioned/typed/authorization/v1/role.go new file mode 100644 index 0000000000..b8409a0483 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/role.go @@ -0,0 +1,139 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + scheme "github.com/openshift/client-go/authorization/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// RolesGetter has a method to return a RoleInterface. +// A group's client should implement this interface. +type RolesGetter interface { + Roles(namespace string) RoleInterface +} + +// RoleInterface has methods to work with Role resources. +type RoleInterface interface { + Create(*v1.Role) (*v1.Role, error) + Update(*v1.Role) (*v1.Role, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.Role, error) + List(opts meta_v1.ListOptions) (*v1.RoleList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Role, err error) + RoleExpansion +} + +// roles implements RoleInterface +type roles struct { + client rest.Interface + ns string +} + +// newRoles returns a Roles +func newRoles(c *AuthorizationV1Client, namespace string) *roles { + return &roles{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the role, and returns the corresponding role object, and an error if there is any. +func (c *roles) Get(name string, options meta_v1.GetOptions) (result *v1.Role, err error) { + result = &v1.Role{} + err = c.client.Get(). + Namespace(c.ns). + Resource("roles"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Roles that match those selectors. +func (c *roles) List(opts meta_v1.ListOptions) (result *v1.RoleList, err error) { + result = &v1.RoleList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("roles"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested roles. +func (c *roles) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("roles"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a role and creates it. Returns the server's representation of the role, and an error, if there is any. +func (c *roles) Create(role *v1.Role) (result *v1.Role, err error) { + result = &v1.Role{} + err = c.client.Post(). + Namespace(c.ns). + Resource("roles"). + Body(role). + Do(). + Into(result) + return +} + +// Update takes the representation of a role and updates it. Returns the server's representation of the role, and an error, if there is any. +func (c *roles) Update(role *v1.Role) (result *v1.Role, err error) { + result = &v1.Role{} + err = c.client.Put(). + Namespace(c.ns). + Resource("roles"). + Name(role.Name). + Body(role). + Do(). + Into(result) + return +} + +// Delete takes name of the role and deletes it. Returns an error if one occurs. +func (c *roles) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("roles"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *roles) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("roles"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched role. +func (c *roles) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Role, err error) { + result = &v1.Role{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("roles"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/rolebinding.go b/authorization/clientset/versioned/typed/authorization/v1/rolebinding.go new file mode 100644 index 0000000000..85f7008f93 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/rolebinding.go @@ -0,0 +1,139 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + scheme "github.com/openshift/client-go/authorization/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// RoleBindingsGetter has a method to return a RoleBindingInterface. +// A group's client should implement this interface. +type RoleBindingsGetter interface { + RoleBindings(namespace string) RoleBindingInterface +} + +// RoleBindingInterface has methods to work with RoleBinding resources. +type RoleBindingInterface interface { + Create(*v1.RoleBinding) (*v1.RoleBinding, error) + Update(*v1.RoleBinding) (*v1.RoleBinding, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.RoleBinding, error) + List(opts meta_v1.ListOptions) (*v1.RoleBindingList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.RoleBinding, err error) + RoleBindingExpansion +} + +// roleBindings implements RoleBindingInterface +type roleBindings struct { + client rest.Interface + ns string +} + +// newRoleBindings returns a RoleBindings +func newRoleBindings(c *AuthorizationV1Client, namespace string) *roleBindings { + return &roleBindings{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the roleBinding, and returns the corresponding roleBinding object, and an error if there is any. +func (c *roleBindings) Get(name string, options meta_v1.GetOptions) (result *v1.RoleBinding, err error) { + result = &v1.RoleBinding{} + err = c.client.Get(). + Namespace(c.ns). + Resource("rolebindings"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of RoleBindings that match those selectors. +func (c *roleBindings) List(opts meta_v1.ListOptions) (result *v1.RoleBindingList, err error) { + result = &v1.RoleBindingList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("rolebindings"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested roleBindings. +func (c *roleBindings) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("rolebindings"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a roleBinding and creates it. Returns the server's representation of the roleBinding, and an error, if there is any. +func (c *roleBindings) Create(roleBinding *v1.RoleBinding) (result *v1.RoleBinding, err error) { + result = &v1.RoleBinding{} + err = c.client.Post(). + Namespace(c.ns). + Resource("rolebindings"). + Body(roleBinding). + Do(). + Into(result) + return +} + +// Update takes the representation of a roleBinding and updates it. Returns the server's representation of the roleBinding, and an error, if there is any. +func (c *roleBindings) Update(roleBinding *v1.RoleBinding) (result *v1.RoleBinding, err error) { + result = &v1.RoleBinding{} + err = c.client.Put(). + Namespace(c.ns). + Resource("rolebindings"). + Name(roleBinding.Name). + Body(roleBinding). + Do(). + Into(result) + return +} + +// Delete takes name of the roleBinding and deletes it. Returns an error if one occurs. +func (c *roleBindings) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("rolebindings"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *roleBindings) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("rolebindings"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched roleBinding. +func (c *roleBindings) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.RoleBinding, err error) { + result = &v1.RoleBinding{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("rolebindings"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/rolebindingrestriction.go b/authorization/clientset/versioned/typed/authorization/v1/rolebindingrestriction.go new file mode 100644 index 0000000000..80e9be6f77 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/rolebindingrestriction.go @@ -0,0 +1,139 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + scheme "github.com/openshift/client-go/authorization/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// RoleBindingRestrictionsGetter has a method to return a RoleBindingRestrictionInterface. +// A group's client should implement this interface. +type RoleBindingRestrictionsGetter interface { + RoleBindingRestrictions(namespace string) RoleBindingRestrictionInterface +} + +// RoleBindingRestrictionInterface has methods to work with RoleBindingRestriction resources. +type RoleBindingRestrictionInterface interface { + Create(*v1.RoleBindingRestriction) (*v1.RoleBindingRestriction, error) + Update(*v1.RoleBindingRestriction) (*v1.RoleBindingRestriction, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.RoleBindingRestriction, error) + List(opts meta_v1.ListOptions) (*v1.RoleBindingRestrictionList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.RoleBindingRestriction, err error) + RoleBindingRestrictionExpansion +} + +// roleBindingRestrictions implements RoleBindingRestrictionInterface +type roleBindingRestrictions struct { + client rest.Interface + ns string +} + +// newRoleBindingRestrictions returns a RoleBindingRestrictions +func newRoleBindingRestrictions(c *AuthorizationV1Client, namespace string) *roleBindingRestrictions { + return &roleBindingRestrictions{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the roleBindingRestriction, and returns the corresponding roleBindingRestriction object, and an error if there is any. +func (c *roleBindingRestrictions) Get(name string, options meta_v1.GetOptions) (result *v1.RoleBindingRestriction, err error) { + result = &v1.RoleBindingRestriction{} + err = c.client.Get(). + Namespace(c.ns). + Resource("rolebindingrestrictions"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of RoleBindingRestrictions that match those selectors. +func (c *roleBindingRestrictions) List(opts meta_v1.ListOptions) (result *v1.RoleBindingRestrictionList, err error) { + result = &v1.RoleBindingRestrictionList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("rolebindingrestrictions"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested roleBindingRestrictions. +func (c *roleBindingRestrictions) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("rolebindingrestrictions"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a roleBindingRestriction and creates it. Returns the server's representation of the roleBindingRestriction, and an error, if there is any. +func (c *roleBindingRestrictions) Create(roleBindingRestriction *v1.RoleBindingRestriction) (result *v1.RoleBindingRestriction, err error) { + result = &v1.RoleBindingRestriction{} + err = c.client.Post(). + Namespace(c.ns). + Resource("rolebindingrestrictions"). + Body(roleBindingRestriction). + Do(). + Into(result) + return +} + +// Update takes the representation of a roleBindingRestriction and updates it. Returns the server's representation of the roleBindingRestriction, and an error, if there is any. +func (c *roleBindingRestrictions) Update(roleBindingRestriction *v1.RoleBindingRestriction) (result *v1.RoleBindingRestriction, err error) { + result = &v1.RoleBindingRestriction{} + err = c.client.Put(). + Namespace(c.ns). + Resource("rolebindingrestrictions"). + Name(roleBindingRestriction.Name). + Body(roleBindingRestriction). + Do(). + Into(result) + return +} + +// Delete takes name of the roleBindingRestriction and deletes it. Returns an error if one occurs. +func (c *roleBindingRestrictions) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("rolebindingrestrictions"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *roleBindingRestrictions) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("rolebindingrestrictions"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched roleBindingRestriction. +func (c *roleBindingRestrictions) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.RoleBindingRestriction, err error) { + result = &v1.RoleBindingRestriction{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("rolebindingrestrictions"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/selfsubjectrulesreview.go b/authorization/clientset/versioned/typed/authorization/v1/selfsubjectrulesreview.go new file mode 100644 index 0000000000..df3edad1e1 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/selfsubjectrulesreview.go @@ -0,0 +1,44 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + rest "k8s.io/client-go/rest" +) + +// SelfSubjectRulesReviewsGetter has a method to return a SelfSubjectRulesReviewInterface. +// A group's client should implement this interface. +type SelfSubjectRulesReviewsGetter interface { + SelfSubjectRulesReviews(namespace string) SelfSubjectRulesReviewInterface +} + +// SelfSubjectRulesReviewInterface has methods to work with SelfSubjectRulesReview resources. +type SelfSubjectRulesReviewInterface interface { + Create(*v1.SelfSubjectRulesReview) (*v1.SelfSubjectRulesReview, error) + SelfSubjectRulesReviewExpansion +} + +// selfSubjectRulesReviews implements SelfSubjectRulesReviewInterface +type selfSubjectRulesReviews struct { + client rest.Interface + ns string +} + +// newSelfSubjectRulesReviews returns a SelfSubjectRulesReviews +func newSelfSubjectRulesReviews(c *AuthorizationV1Client, namespace string) *selfSubjectRulesReviews { + return &selfSubjectRulesReviews{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a selfSubjectRulesReview and creates it. Returns the server's representation of the selfSubjectRulesReview, and an error, if there is any. +func (c *selfSubjectRulesReviews) Create(selfSubjectRulesReview *v1.SelfSubjectRulesReview) (result *v1.SelfSubjectRulesReview, err error) { + result = &v1.SelfSubjectRulesReview{} + err = c.client.Post(). + Namespace(c.ns). + Resource("selfsubjectrulesreviews"). + Body(selfSubjectRulesReview). + Do(). + Into(result) + return +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/subjectaccessreview.go b/authorization/clientset/versioned/typed/authorization/v1/subjectaccessreview.go new file mode 100644 index 0000000000..08d0e5f5aa --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/subjectaccessreview.go @@ -0,0 +1,42 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + rest "k8s.io/client-go/rest" +) + +// SubjectAccessReviewsGetter has a method to return a SubjectAccessReviewInterface. +// A group's client should implement this interface. +type SubjectAccessReviewsGetter interface { + SubjectAccessReviews() SubjectAccessReviewInterface +} + +// SubjectAccessReviewInterface has methods to work with SubjectAccessReview resources. +type SubjectAccessReviewInterface interface { + Create(*v1.SubjectAccessReview) (*v1.SubjectAccessReviewResponse, error) + + SubjectAccessReviewExpansion +} + +// subjectAccessReviews implements SubjectAccessReviewInterface +type subjectAccessReviews struct { + client rest.Interface +} + +// newSubjectAccessReviews returns a SubjectAccessReviews +func newSubjectAccessReviews(c *AuthorizationV1Client) *subjectAccessReviews { + return &subjectAccessReviews{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a subjectAccessReview and creates it. Returns the server's representation of the subjectAccessReviewResponse, and an error, if there is any. +func (c *subjectAccessReviews) Create(subjectAccessReview *v1.SubjectAccessReview) (result *v1.SubjectAccessReviewResponse, err error) { + result = &v1.SubjectAccessReviewResponse{} + err = c.client.Post(). + Resource("subjectaccessreviews"). + Body(subjectAccessReview). + Do(). + Into(result) + return +} diff --git a/authorization/clientset/versioned/typed/authorization/v1/subjectrulesreview.go b/authorization/clientset/versioned/typed/authorization/v1/subjectrulesreview.go new file mode 100644 index 0000000000..4e407a2399 --- /dev/null +++ b/authorization/clientset/versioned/typed/authorization/v1/subjectrulesreview.go @@ -0,0 +1,44 @@ +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + rest "k8s.io/client-go/rest" +) + +// SubjectRulesReviewsGetter has a method to return a SubjectRulesReviewInterface. +// A group's client should implement this interface. +type SubjectRulesReviewsGetter interface { + SubjectRulesReviews(namespace string) SubjectRulesReviewInterface +} + +// SubjectRulesReviewInterface has methods to work with SubjectRulesReview resources. +type SubjectRulesReviewInterface interface { + Create(*v1.SubjectRulesReview) (*v1.SubjectRulesReview, error) + SubjectRulesReviewExpansion +} + +// subjectRulesReviews implements SubjectRulesReviewInterface +type subjectRulesReviews struct { + client rest.Interface + ns string +} + +// newSubjectRulesReviews returns a SubjectRulesReviews +func newSubjectRulesReviews(c *AuthorizationV1Client, namespace string) *subjectRulesReviews { + return &subjectRulesReviews{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a subjectRulesReview and creates it. Returns the server's representation of the subjectRulesReview, and an error, if there is any. +func (c *subjectRulesReviews) Create(subjectRulesReview *v1.SubjectRulesReview) (result *v1.SubjectRulesReview, err error) { + result = &v1.SubjectRulesReview{} + err = c.client.Post(). + Namespace(c.ns). + Resource("subjectrulesreviews"). + Body(subjectRulesReview). + Do(). + Into(result) + return +} diff --git a/authorization/informers/externalversions/authorization/interface.go b/authorization/informers/externalversions/authorization/interface.go new file mode 100644 index 0000000000..4ab0bec67c --- /dev/null +++ b/authorization/informers/externalversions/authorization/interface.go @@ -0,0 +1,28 @@ +// This file was automatically generated by informer-gen + +package authorization + +import ( + v1 "github.com/openshift/client-go/authorization/informers/externalversions/authorization/v1" + internalinterfaces "github.com/openshift/client-go/authorization/informers/externalversions/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &group{f} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.SharedInformerFactory) +} diff --git a/authorization/informers/externalversions/authorization/v1/clusterpolicy.go b/authorization/informers/externalversions/authorization/v1/clusterpolicy.go new file mode 100644 index 0000000000..87c625abf3 --- /dev/null +++ b/authorization/informers/externalversions/authorization/v1/clusterpolicy.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + versioned "github.com/openshift/client-go/authorization/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/authorization/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/authorization/listers/authorization/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// ClusterPolicyInformer provides access to a shared informer and lister for +// ClusterPolicies. +type ClusterPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ClusterPolicyLister +} + +type clusterPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewClusterPolicyInformer constructs a new informer for ClusterPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterPolicyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.AuthorizationV1().ClusterPolicies().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.AuthorizationV1().ClusterPolicies().Watch(options) + }, + }, + &authorization_v1.ClusterPolicy{}, + resyncPeriod, + indexers, + ) +} + +func defaultClusterPolicyInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewClusterPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *clusterPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&authorization_v1.ClusterPolicy{}, defaultClusterPolicyInformer) +} + +func (f *clusterPolicyInformer) Lister() v1.ClusterPolicyLister { + return v1.NewClusterPolicyLister(f.Informer().GetIndexer()) +} diff --git a/authorization/informers/externalversions/authorization/v1/clusterpolicybinding.go b/authorization/informers/externalversions/authorization/v1/clusterpolicybinding.go new file mode 100644 index 0000000000..1702ef4625 --- /dev/null +++ b/authorization/informers/externalversions/authorization/v1/clusterpolicybinding.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + versioned "github.com/openshift/client-go/authorization/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/authorization/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/authorization/listers/authorization/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// ClusterPolicyBindingInformer provides access to a shared informer and lister for +// ClusterPolicyBindings. +type ClusterPolicyBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ClusterPolicyBindingLister +} + +type clusterPolicyBindingInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewClusterPolicyBindingInformer constructs a new informer for ClusterPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterPolicyBindingInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.AuthorizationV1().ClusterPolicyBindings().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.AuthorizationV1().ClusterPolicyBindings().Watch(options) + }, + }, + &authorization_v1.ClusterPolicyBinding{}, + resyncPeriod, + indexers, + ) +} + +func defaultClusterPolicyBindingInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewClusterPolicyBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *clusterPolicyBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&authorization_v1.ClusterPolicyBinding{}, defaultClusterPolicyBindingInformer) +} + +func (f *clusterPolicyBindingInformer) Lister() v1.ClusterPolicyBindingLister { + return v1.NewClusterPolicyBindingLister(f.Informer().GetIndexer()) +} diff --git a/authorization/informers/externalversions/authorization/v1/clusterrole.go b/authorization/informers/externalversions/authorization/v1/clusterrole.go new file mode 100644 index 0000000000..ea6163e544 --- /dev/null +++ b/authorization/informers/externalversions/authorization/v1/clusterrole.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + versioned "github.com/openshift/client-go/authorization/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/authorization/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/authorization/listers/authorization/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// ClusterRoleInformer provides access to a shared informer and lister for +// ClusterRoles. +type ClusterRoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ClusterRoleLister +} + +type clusterRoleInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.AuthorizationV1().ClusterRoles().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.AuthorizationV1().ClusterRoles().Watch(options) + }, + }, + &authorization_v1.ClusterRole{}, + resyncPeriod, + indexers, + ) +} + +func defaultClusterRoleInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewClusterRoleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&authorization_v1.ClusterRole{}, defaultClusterRoleInformer) +} + +func (f *clusterRoleInformer) Lister() v1.ClusterRoleLister { + return v1.NewClusterRoleLister(f.Informer().GetIndexer()) +} diff --git a/authorization/informers/externalversions/authorization/v1/clusterrolebinding.go b/authorization/informers/externalversions/authorization/v1/clusterrolebinding.go new file mode 100644 index 0000000000..db225e6c25 --- /dev/null +++ b/authorization/informers/externalversions/authorization/v1/clusterrolebinding.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + versioned "github.com/openshift/client-go/authorization/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/authorization/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/authorization/listers/authorization/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// ClusterRoleBindingInformer provides access to a shared informer and lister for +// ClusterRoleBindings. +type ClusterRoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ClusterRoleBindingLister +} + +type clusterRoleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleBindingInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.AuthorizationV1().ClusterRoleBindings().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.AuthorizationV1().ClusterRoleBindings().Watch(options) + }, + }, + &authorization_v1.ClusterRoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func defaultClusterRoleBindingInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewClusterRoleBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&authorization_v1.ClusterRoleBinding{}, defaultClusterRoleBindingInformer) +} + +func (f *clusterRoleBindingInformer) Lister() v1.ClusterRoleBindingLister { + return v1.NewClusterRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/authorization/informers/externalversions/authorization/v1/interface.go b/authorization/informers/externalversions/authorization/v1/interface.go new file mode 100644 index 0000000000..e5eee4d12f --- /dev/null +++ b/authorization/informers/externalversions/authorization/v1/interface.go @@ -0,0 +1,83 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + internalinterfaces "github.com/openshift/client-go/authorization/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ClusterPolicies returns a ClusterPolicyInformer. + ClusterPolicies() ClusterPolicyInformer + // ClusterPolicyBindings returns a ClusterPolicyBindingInformer. + ClusterPolicyBindings() ClusterPolicyBindingInformer + // ClusterRoles returns a ClusterRoleInformer. + ClusterRoles() ClusterRoleInformer + // ClusterRoleBindings returns a ClusterRoleBindingInformer. + ClusterRoleBindings() ClusterRoleBindingInformer + // Policies returns a PolicyInformer. + Policies() PolicyInformer + // PolicyBindings returns a PolicyBindingInformer. + PolicyBindings() PolicyBindingInformer + // Roles returns a RoleInformer. + Roles() RoleInformer + // RoleBindings returns a RoleBindingInformer. + RoleBindings() RoleBindingInformer + // RoleBindingRestrictions returns a RoleBindingRestrictionInformer. + RoleBindingRestrictions() RoleBindingRestrictionInformer +} + +type version struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &version{f} +} + +// ClusterPolicies returns a ClusterPolicyInformer. +func (v *version) ClusterPolicies() ClusterPolicyInformer { + return &clusterPolicyInformer{factory: v.SharedInformerFactory} +} + +// ClusterPolicyBindings returns a ClusterPolicyBindingInformer. +func (v *version) ClusterPolicyBindings() ClusterPolicyBindingInformer { + return &clusterPolicyBindingInformer{factory: v.SharedInformerFactory} +} + +// ClusterRoles returns a ClusterRoleInformer. +func (v *version) ClusterRoles() ClusterRoleInformer { + return &clusterRoleInformer{factory: v.SharedInformerFactory} +} + +// ClusterRoleBindings returns a ClusterRoleBindingInformer. +func (v *version) ClusterRoleBindings() ClusterRoleBindingInformer { + return &clusterRoleBindingInformer{factory: v.SharedInformerFactory} +} + +// Policies returns a PolicyInformer. +func (v *version) Policies() PolicyInformer { + return &policyInformer{factory: v.SharedInformerFactory} +} + +// PolicyBindings returns a PolicyBindingInformer. +func (v *version) PolicyBindings() PolicyBindingInformer { + return &policyBindingInformer{factory: v.SharedInformerFactory} +} + +// Roles returns a RoleInformer. +func (v *version) Roles() RoleInformer { + return &roleInformer{factory: v.SharedInformerFactory} +} + +// RoleBindings returns a RoleBindingInformer. +func (v *version) RoleBindings() RoleBindingInformer { + return &roleBindingInformer{factory: v.SharedInformerFactory} +} + +// RoleBindingRestrictions returns a RoleBindingRestrictionInformer. +func (v *version) RoleBindingRestrictions() RoleBindingRestrictionInformer { + return &roleBindingRestrictionInformer{factory: v.SharedInformerFactory} +} diff --git a/authorization/informers/externalversions/authorization/v1/policy.go b/authorization/informers/externalversions/authorization/v1/policy.go new file mode 100644 index 0000000000..155a44f57f --- /dev/null +++ b/authorization/informers/externalversions/authorization/v1/policy.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + versioned "github.com/openshift/client-go/authorization/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/authorization/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/authorization/listers/authorization/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// PolicyInformer provides access to a shared informer and lister for +// Policies. +type PolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PolicyLister +} + +type policyInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewPolicyInformer constructs a new informer for Policy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.AuthorizationV1().Policies(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.AuthorizationV1().Policies(namespace).Watch(options) + }, + }, + &authorization_v1.Policy{}, + resyncPeriod, + indexers, + ) +} + +func defaultPolicyInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewPolicyInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *policyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&authorization_v1.Policy{}, defaultPolicyInformer) +} + +func (f *policyInformer) Lister() v1.PolicyLister { + return v1.NewPolicyLister(f.Informer().GetIndexer()) +} diff --git a/authorization/informers/externalversions/authorization/v1/policybinding.go b/authorization/informers/externalversions/authorization/v1/policybinding.go new file mode 100644 index 0000000000..f8ce8b2fd7 --- /dev/null +++ b/authorization/informers/externalversions/authorization/v1/policybinding.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + versioned "github.com/openshift/client-go/authorization/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/authorization/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/authorization/listers/authorization/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// PolicyBindingInformer provides access to a shared informer and lister for +// PolicyBindings. +type PolicyBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PolicyBindingLister +} + +type policyBindingInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewPolicyBindingInformer constructs a new informer for PolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPolicyBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.AuthorizationV1().PolicyBindings(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.AuthorizationV1().PolicyBindings(namespace).Watch(options) + }, + }, + &authorization_v1.PolicyBinding{}, + resyncPeriod, + indexers, + ) +} + +func defaultPolicyBindingInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewPolicyBindingInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *policyBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&authorization_v1.PolicyBinding{}, defaultPolicyBindingInformer) +} + +func (f *policyBindingInformer) Lister() v1.PolicyBindingLister { + return v1.NewPolicyBindingLister(f.Informer().GetIndexer()) +} diff --git a/authorization/informers/externalversions/authorization/v1/role.go b/authorization/informers/externalversions/authorization/v1/role.go new file mode 100644 index 0000000000..c92e950ce8 --- /dev/null +++ b/authorization/informers/externalversions/authorization/v1/role.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + versioned "github.com/openshift/client-go/authorization/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/authorization/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/authorization/listers/authorization/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// RoleInformer provides access to a shared informer and lister for +// Roles. +type RoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.RoleLister +} + +type roleInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.AuthorizationV1().Roles(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.AuthorizationV1().Roles(namespace).Watch(options) + }, + }, + &authorization_v1.Role{}, + resyncPeriod, + indexers, + ) +} + +func defaultRoleInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewRoleInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *roleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&authorization_v1.Role{}, defaultRoleInformer) +} + +func (f *roleInformer) Lister() v1.RoleLister { + return v1.NewRoleLister(f.Informer().GetIndexer()) +} diff --git a/authorization/informers/externalversions/authorization/v1/rolebinding.go b/authorization/informers/externalversions/authorization/v1/rolebinding.go new file mode 100644 index 0000000000..677195a0b2 --- /dev/null +++ b/authorization/informers/externalversions/authorization/v1/rolebinding.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + versioned "github.com/openshift/client-go/authorization/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/authorization/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/authorization/listers/authorization/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// RoleBindingInformer provides access to a shared informer and lister for +// RoleBindings. +type RoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.RoleBindingLister +} + +type roleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.AuthorizationV1().RoleBindings(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.AuthorizationV1().RoleBindings(namespace).Watch(options) + }, + }, + &authorization_v1.RoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func defaultRoleBindingInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewRoleBindingInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&authorization_v1.RoleBinding{}, defaultRoleBindingInformer) +} + +func (f *roleBindingInformer) Lister() v1.RoleBindingLister { + return v1.NewRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/authorization/informers/externalversions/authorization/v1/rolebindingrestriction.go b/authorization/informers/externalversions/authorization/v1/rolebindingrestriction.go new file mode 100644 index 0000000000..abe0a6354b --- /dev/null +++ b/authorization/informers/externalversions/authorization/v1/rolebindingrestriction.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + authorization_v1 "github.com/openshift/api/authorization/v1" + versioned "github.com/openshift/client-go/authorization/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/authorization/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/authorization/listers/authorization/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// RoleBindingRestrictionInformer provides access to a shared informer and lister for +// RoleBindingRestrictions. +type RoleBindingRestrictionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.RoleBindingRestrictionLister +} + +type roleBindingRestrictionInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewRoleBindingRestrictionInformer constructs a new informer for RoleBindingRestriction type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingRestrictionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.AuthorizationV1().RoleBindingRestrictions(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.AuthorizationV1().RoleBindingRestrictions(namespace).Watch(options) + }, + }, + &authorization_v1.RoleBindingRestriction{}, + resyncPeriod, + indexers, + ) +} + +func defaultRoleBindingRestrictionInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewRoleBindingRestrictionInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *roleBindingRestrictionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&authorization_v1.RoleBindingRestriction{}, defaultRoleBindingRestrictionInformer) +} + +func (f *roleBindingRestrictionInformer) Lister() v1.RoleBindingRestrictionLister { + return v1.NewRoleBindingRestrictionLister(f.Informer().GetIndexer()) +} diff --git a/authorization/informers/externalversions/factory.go b/authorization/informers/externalversions/factory.go new file mode 100644 index 0000000000..f6262db8c5 --- /dev/null +++ b/authorization/informers/externalversions/factory.go @@ -0,0 +1,102 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + versioned "github.com/openshift/client-go/authorization/clientset/versioned" + authorization "github.com/openshift/client-go/authorization/informers/externalversions/authorization" + internalinterfaces "github.com/openshift/client-go/authorization/informers/externalversions/internalinterfaces" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + reflect "reflect" + sync "sync" + time "time" +) + +type sharedInformerFactory struct { + client versioned.Interface + lock sync.Mutex + defaultResync time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return &sharedInformerFactory{ + client: client, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + } +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + informer = newFunc(f.client, f.defaultResync) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Authorization() authorization.Interface +} + +func (f *sharedInformerFactory) Authorization() authorization.Interface { + return authorization.New(f) +} diff --git a/authorization/informers/externalversions/generic.go b/authorization/informers/externalversions/generic.go new file mode 100644 index 0000000000..3479aa4f0a --- /dev/null +++ b/authorization/informers/externalversions/generic.go @@ -0,0 +1,61 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + "fmt" + v1 "github.com/openshift/api/authorization/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=Authorization, Version=V1 + case v1.SchemeGroupVersion.WithResource("clusterpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Authorization().V1().ClusterPolicies().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("clusterpolicybindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Authorization().V1().ClusterPolicyBindings().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("clusterroles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Authorization().V1().ClusterRoles().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("clusterrolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Authorization().V1().ClusterRoleBindings().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("policies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Authorization().V1().Policies().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("policybindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Authorization().V1().PolicyBindings().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("roles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Authorization().V1().Roles().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("rolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Authorization().V1().RoleBindings().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("rolebindingrestrictions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Authorization().V1().RoleBindingRestrictions().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/authorization/informers/externalversions/internalinterfaces/factory_interfaces.go b/authorization/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..49e208b9db --- /dev/null +++ b/authorization/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,18 @@ +// This file was automatically generated by informer-gen + +package internalinterfaces + +import ( + versioned "github.com/openshift/client-go/authorization/clientset/versioned" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} diff --git a/authorization/listers/authorization/v1/clusterpolicy.go b/authorization/listers/authorization/v1/clusterpolicy.go new file mode 100644 index 0000000000..bf89f0e55e --- /dev/null +++ b/authorization/listers/authorization/v1/clusterpolicy.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterPolicyLister helps list ClusterPolicies. +type ClusterPolicyLister interface { + // List lists all ClusterPolicies in the indexer. + List(selector labels.Selector) (ret []*v1.ClusterPolicy, err error) + // Get retrieves the ClusterPolicy from the index for a given name. + Get(name string) (*v1.ClusterPolicy, error) + ClusterPolicyListerExpansion +} + +// clusterPolicyLister implements the ClusterPolicyLister interface. +type clusterPolicyLister struct { + indexer cache.Indexer +} + +// NewClusterPolicyLister returns a new ClusterPolicyLister. +func NewClusterPolicyLister(indexer cache.Indexer) ClusterPolicyLister { + return &clusterPolicyLister{indexer: indexer} +} + +// List lists all ClusterPolicies in the indexer. +func (s *clusterPolicyLister) List(selector labels.Selector) (ret []*v1.ClusterPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterPolicy)) + }) + return ret, err +} + +// Get retrieves the ClusterPolicy from the index for a given name. +func (s *clusterPolicyLister) Get(name string) (*v1.ClusterPolicy, error) { + key := &v1.ClusterPolicy{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("clusterpolicy"), name) + } + return obj.(*v1.ClusterPolicy), nil +} diff --git a/authorization/listers/authorization/v1/clusterpolicybinding.go b/authorization/listers/authorization/v1/clusterpolicybinding.go new file mode 100644 index 0000000000..69747e9244 --- /dev/null +++ b/authorization/listers/authorization/v1/clusterpolicybinding.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterPolicyBindingLister helps list ClusterPolicyBindings. +type ClusterPolicyBindingLister interface { + // List lists all ClusterPolicyBindings in the indexer. + List(selector labels.Selector) (ret []*v1.ClusterPolicyBinding, err error) + // Get retrieves the ClusterPolicyBinding from the index for a given name. + Get(name string) (*v1.ClusterPolicyBinding, error) + ClusterPolicyBindingListerExpansion +} + +// clusterPolicyBindingLister implements the ClusterPolicyBindingLister interface. +type clusterPolicyBindingLister struct { + indexer cache.Indexer +} + +// NewClusterPolicyBindingLister returns a new ClusterPolicyBindingLister. +func NewClusterPolicyBindingLister(indexer cache.Indexer) ClusterPolicyBindingLister { + return &clusterPolicyBindingLister{indexer: indexer} +} + +// List lists all ClusterPolicyBindings in the indexer. +func (s *clusterPolicyBindingLister) List(selector labels.Selector) (ret []*v1.ClusterPolicyBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterPolicyBinding)) + }) + return ret, err +} + +// Get retrieves the ClusterPolicyBinding from the index for a given name. +func (s *clusterPolicyBindingLister) Get(name string) (*v1.ClusterPolicyBinding, error) { + key := &v1.ClusterPolicyBinding{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("clusterpolicybinding"), name) + } + return obj.(*v1.ClusterPolicyBinding), nil +} diff --git a/authorization/listers/authorization/v1/clusterrole.go b/authorization/listers/authorization/v1/clusterrole.go new file mode 100644 index 0000000000..e61a03fff6 --- /dev/null +++ b/authorization/listers/authorization/v1/clusterrole.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleLister helps list ClusterRoles. +type ClusterRoleLister interface { + // List lists all ClusterRoles in the indexer. + List(selector labels.Selector) (ret []*v1.ClusterRole, err error) + // Get retrieves the ClusterRole from the index for a given name. + Get(name string) (*v1.ClusterRole, error) + ClusterRoleListerExpansion +} + +// clusterRoleLister implements the ClusterRoleLister interface. +type clusterRoleLister struct { + indexer cache.Indexer +} + +// NewClusterRoleLister returns a new ClusterRoleLister. +func NewClusterRoleLister(indexer cache.Indexer) ClusterRoleLister { + return &clusterRoleLister{indexer: indexer} +} + +// List lists all ClusterRoles in the indexer. +func (s *clusterRoleLister) List(selector labels.Selector) (ret []*v1.ClusterRole, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterRole)) + }) + return ret, err +} + +// Get retrieves the ClusterRole from the index for a given name. +func (s *clusterRoleLister) Get(name string) (*v1.ClusterRole, error) { + key := &v1.ClusterRole{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("clusterrole"), name) + } + return obj.(*v1.ClusterRole), nil +} diff --git a/authorization/listers/authorization/v1/clusterrolebinding.go b/authorization/listers/authorization/v1/clusterrolebinding.go new file mode 100644 index 0000000000..4cede62256 --- /dev/null +++ b/authorization/listers/authorization/v1/clusterrolebinding.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingLister helps list ClusterRoleBindings. +type ClusterRoleBindingLister interface { + // List lists all ClusterRoleBindings in the indexer. + List(selector labels.Selector) (ret []*v1.ClusterRoleBinding, err error) + // Get retrieves the ClusterRoleBinding from the index for a given name. + Get(name string) (*v1.ClusterRoleBinding, error) + ClusterRoleBindingListerExpansion +} + +// clusterRoleBindingLister implements the ClusterRoleBindingLister interface. +type clusterRoleBindingLister struct { + indexer cache.Indexer +} + +// NewClusterRoleBindingLister returns a new ClusterRoleBindingLister. +func NewClusterRoleBindingLister(indexer cache.Indexer) ClusterRoleBindingLister { + return &clusterRoleBindingLister{indexer: indexer} +} + +// List lists all ClusterRoleBindings in the indexer. +func (s *clusterRoleBindingLister) List(selector labels.Selector) (ret []*v1.ClusterRoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterRoleBinding)) + }) + return ret, err +} + +// Get retrieves the ClusterRoleBinding from the index for a given name. +func (s *clusterRoleBindingLister) Get(name string) (*v1.ClusterRoleBinding, error) { + key := &v1.ClusterRoleBinding{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("clusterrolebinding"), name) + } + return obj.(*v1.ClusterRoleBinding), nil +} diff --git a/authorization/listers/authorization/v1/expansion_generated.go b/authorization/listers/authorization/v1/expansion_generated.go new file mode 100644 index 0000000000..198c26a28b --- /dev/null +++ b/authorization/listers/authorization/v1/expansion_generated.go @@ -0,0 +1,59 @@ +// This file was automatically generated by lister-gen + +package v1 + +// ClusterPolicyListerExpansion allows custom methods to be added to +// ClusterPolicyLister. +type ClusterPolicyListerExpansion interface{} + +// ClusterPolicyBindingListerExpansion allows custom methods to be added to +// ClusterPolicyBindingLister. +type ClusterPolicyBindingListerExpansion interface{} + +// ClusterRoleListerExpansion allows custom methods to be added to +// ClusterRoleLister. +type ClusterRoleListerExpansion interface{} + +// ClusterRoleBindingListerExpansion allows custom methods to be added to +// ClusterRoleBindingLister. +type ClusterRoleBindingListerExpansion interface{} + +// PolicyListerExpansion allows custom methods to be added to +// PolicyLister. +type PolicyListerExpansion interface{} + +// PolicyNamespaceListerExpansion allows custom methods to be added to +// PolicyNamespaceLister. +type PolicyNamespaceListerExpansion interface{} + +// PolicyBindingListerExpansion allows custom methods to be added to +// PolicyBindingLister. +type PolicyBindingListerExpansion interface{} + +// PolicyBindingNamespaceListerExpansion allows custom methods to be added to +// PolicyBindingNamespaceLister. +type PolicyBindingNamespaceListerExpansion interface{} + +// RoleListerExpansion allows custom methods to be added to +// RoleLister. +type RoleListerExpansion interface{} + +// RoleNamespaceListerExpansion allows custom methods to be added to +// RoleNamespaceLister. +type RoleNamespaceListerExpansion interface{} + +// RoleBindingListerExpansion allows custom methods to be added to +// RoleBindingLister. +type RoleBindingListerExpansion interface{} + +// RoleBindingNamespaceListerExpansion allows custom methods to be added to +// RoleBindingNamespaceLister. +type RoleBindingNamespaceListerExpansion interface{} + +// RoleBindingRestrictionListerExpansion allows custom methods to be added to +// RoleBindingRestrictionLister. +type RoleBindingRestrictionListerExpansion interface{} + +// RoleBindingRestrictionNamespaceListerExpansion allows custom methods to be added to +// RoleBindingRestrictionNamespaceLister. +type RoleBindingRestrictionNamespaceListerExpansion interface{} diff --git a/authorization/listers/authorization/v1/policy.go b/authorization/listers/authorization/v1/policy.go new file mode 100644 index 0000000000..8b0de84039 --- /dev/null +++ b/authorization/listers/authorization/v1/policy.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PolicyLister helps list Policies. +type PolicyLister interface { + // List lists all Policies in the indexer. + List(selector labels.Selector) (ret []*v1.Policy, err error) + // Policies returns an object that can list and get Policies. + Policies(namespace string) PolicyNamespaceLister + PolicyListerExpansion +} + +// policyLister implements the PolicyLister interface. +type policyLister struct { + indexer cache.Indexer +} + +// NewPolicyLister returns a new PolicyLister. +func NewPolicyLister(indexer cache.Indexer) PolicyLister { + return &policyLister{indexer: indexer} +} + +// List lists all Policies in the indexer. +func (s *policyLister) List(selector labels.Selector) (ret []*v1.Policy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Policy)) + }) + return ret, err +} + +// Policies returns an object that can list and get Policies. +func (s *policyLister) Policies(namespace string) PolicyNamespaceLister { + return policyNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PolicyNamespaceLister helps list and get Policies. +type PolicyNamespaceLister interface { + // List lists all Policies in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.Policy, err error) + // Get retrieves the Policy from the indexer for a given namespace and name. + Get(name string) (*v1.Policy, error) + PolicyNamespaceListerExpansion +} + +// policyNamespaceLister implements the PolicyNamespaceLister +// interface. +type policyNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Policies in the indexer for a given namespace. +func (s policyNamespaceLister) List(selector labels.Selector) (ret []*v1.Policy, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Policy)) + }) + return ret, err +} + +// Get retrieves the Policy from the indexer for a given namespace and name. +func (s policyNamespaceLister) Get(name string) (*v1.Policy, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("policy"), name) + } + return obj.(*v1.Policy), nil +} diff --git a/authorization/listers/authorization/v1/policybinding.go b/authorization/listers/authorization/v1/policybinding.go new file mode 100644 index 0000000000..0b632bd4f6 --- /dev/null +++ b/authorization/listers/authorization/v1/policybinding.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PolicyBindingLister helps list PolicyBindings. +type PolicyBindingLister interface { + // List lists all PolicyBindings in the indexer. + List(selector labels.Selector) (ret []*v1.PolicyBinding, err error) + // PolicyBindings returns an object that can list and get PolicyBindings. + PolicyBindings(namespace string) PolicyBindingNamespaceLister + PolicyBindingListerExpansion +} + +// policyBindingLister implements the PolicyBindingLister interface. +type policyBindingLister struct { + indexer cache.Indexer +} + +// NewPolicyBindingLister returns a new PolicyBindingLister. +func NewPolicyBindingLister(indexer cache.Indexer) PolicyBindingLister { + return &policyBindingLister{indexer: indexer} +} + +// List lists all PolicyBindings in the indexer. +func (s *policyBindingLister) List(selector labels.Selector) (ret []*v1.PolicyBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PolicyBinding)) + }) + return ret, err +} + +// PolicyBindings returns an object that can list and get PolicyBindings. +func (s *policyBindingLister) PolicyBindings(namespace string) PolicyBindingNamespaceLister { + return policyBindingNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PolicyBindingNamespaceLister helps list and get PolicyBindings. +type PolicyBindingNamespaceLister interface { + // List lists all PolicyBindings in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.PolicyBinding, err error) + // Get retrieves the PolicyBinding from the indexer for a given namespace and name. + Get(name string) (*v1.PolicyBinding, error) + PolicyBindingNamespaceListerExpansion +} + +// policyBindingNamespaceLister implements the PolicyBindingNamespaceLister +// interface. +type policyBindingNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PolicyBindings in the indexer for a given namespace. +func (s policyBindingNamespaceLister) List(selector labels.Selector) (ret []*v1.PolicyBinding, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PolicyBinding)) + }) + return ret, err +} + +// Get retrieves the PolicyBinding from the indexer for a given namespace and name. +func (s policyBindingNamespaceLister) Get(name string) (*v1.PolicyBinding, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("policybinding"), name) + } + return obj.(*v1.PolicyBinding), nil +} diff --git a/authorization/listers/authorization/v1/role.go b/authorization/listers/authorization/v1/role.go new file mode 100644 index 0000000000..35911add6b --- /dev/null +++ b/authorization/listers/authorization/v1/role.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleLister helps list Roles. +type RoleLister interface { + // List lists all Roles in the indexer. + List(selector labels.Selector) (ret []*v1.Role, err error) + // Roles returns an object that can list and get Roles. + Roles(namespace string) RoleNamespaceLister + RoleListerExpansion +} + +// roleLister implements the RoleLister interface. +type roleLister struct { + indexer cache.Indexer +} + +// NewRoleLister returns a new RoleLister. +func NewRoleLister(indexer cache.Indexer) RoleLister { + return &roleLister{indexer: indexer} +} + +// List lists all Roles in the indexer. +func (s *roleLister) List(selector labels.Selector) (ret []*v1.Role, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Role)) + }) + return ret, err +} + +// Roles returns an object that can list and get Roles. +func (s *roleLister) Roles(namespace string) RoleNamespaceLister { + return roleNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleNamespaceLister helps list and get Roles. +type RoleNamespaceLister interface { + // List lists all Roles in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.Role, err error) + // Get retrieves the Role from the indexer for a given namespace and name. + Get(name string) (*v1.Role, error) + RoleNamespaceListerExpansion +} + +// roleNamespaceLister implements the RoleNamespaceLister +// interface. +type roleNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Roles in the indexer for a given namespace. +func (s roleNamespaceLister) List(selector labels.Selector) (ret []*v1.Role, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Role)) + }) + return ret, err +} + +// Get retrieves the Role from the indexer for a given namespace and name. +func (s roleNamespaceLister) Get(name string) (*v1.Role, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("role"), name) + } + return obj.(*v1.Role), nil +} diff --git a/authorization/listers/authorization/v1/rolebinding.go b/authorization/listers/authorization/v1/rolebinding.go new file mode 100644 index 0000000000..7a8dcad54e --- /dev/null +++ b/authorization/listers/authorization/v1/rolebinding.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleBindingLister helps list RoleBindings. +type RoleBindingLister interface { + // List lists all RoleBindings in the indexer. + List(selector labels.Selector) (ret []*v1.RoleBinding, err error) + // RoleBindings returns an object that can list and get RoleBindings. + RoleBindings(namespace string) RoleBindingNamespaceLister + RoleBindingListerExpansion +} + +// roleBindingLister implements the RoleBindingLister interface. +type roleBindingLister struct { + indexer cache.Indexer +} + +// NewRoleBindingLister returns a new RoleBindingLister. +func NewRoleBindingLister(indexer cache.Indexer) RoleBindingLister { + return &roleBindingLister{indexer: indexer} +} + +// List lists all RoleBindings in the indexer. +func (s *roleBindingLister) List(selector labels.Selector) (ret []*v1.RoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.RoleBinding)) + }) + return ret, err +} + +// RoleBindings returns an object that can list and get RoleBindings. +func (s *roleBindingLister) RoleBindings(namespace string) RoleBindingNamespaceLister { + return roleBindingNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleBindingNamespaceLister helps list and get RoleBindings. +type RoleBindingNamespaceLister interface { + // List lists all RoleBindings in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.RoleBinding, err error) + // Get retrieves the RoleBinding from the indexer for a given namespace and name. + Get(name string) (*v1.RoleBinding, error) + RoleBindingNamespaceListerExpansion +} + +// roleBindingNamespaceLister implements the RoleBindingNamespaceLister +// interface. +type roleBindingNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RoleBindings in the indexer for a given namespace. +func (s roleBindingNamespaceLister) List(selector labels.Selector) (ret []*v1.RoleBinding, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.RoleBinding)) + }) + return ret, err +} + +// Get retrieves the RoleBinding from the indexer for a given namespace and name. +func (s roleBindingNamespaceLister) Get(name string) (*v1.RoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("rolebinding"), name) + } + return obj.(*v1.RoleBinding), nil +} diff --git a/authorization/listers/authorization/v1/rolebindingrestriction.go b/authorization/listers/authorization/v1/rolebindingrestriction.go new file mode 100644 index 0000000000..6d86eeff1a --- /dev/null +++ b/authorization/listers/authorization/v1/rolebindingrestriction.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/authorization/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleBindingRestrictionLister helps list RoleBindingRestrictions. +type RoleBindingRestrictionLister interface { + // List lists all RoleBindingRestrictions in the indexer. + List(selector labels.Selector) (ret []*v1.RoleBindingRestriction, err error) + // RoleBindingRestrictions returns an object that can list and get RoleBindingRestrictions. + RoleBindingRestrictions(namespace string) RoleBindingRestrictionNamespaceLister + RoleBindingRestrictionListerExpansion +} + +// roleBindingRestrictionLister implements the RoleBindingRestrictionLister interface. +type roleBindingRestrictionLister struct { + indexer cache.Indexer +} + +// NewRoleBindingRestrictionLister returns a new RoleBindingRestrictionLister. +func NewRoleBindingRestrictionLister(indexer cache.Indexer) RoleBindingRestrictionLister { + return &roleBindingRestrictionLister{indexer: indexer} +} + +// List lists all RoleBindingRestrictions in the indexer. +func (s *roleBindingRestrictionLister) List(selector labels.Selector) (ret []*v1.RoleBindingRestriction, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.RoleBindingRestriction)) + }) + return ret, err +} + +// RoleBindingRestrictions returns an object that can list and get RoleBindingRestrictions. +func (s *roleBindingRestrictionLister) RoleBindingRestrictions(namespace string) RoleBindingRestrictionNamespaceLister { + return roleBindingRestrictionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleBindingRestrictionNamespaceLister helps list and get RoleBindingRestrictions. +type RoleBindingRestrictionNamespaceLister interface { + // List lists all RoleBindingRestrictions in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.RoleBindingRestriction, err error) + // Get retrieves the RoleBindingRestriction from the indexer for a given namespace and name. + Get(name string) (*v1.RoleBindingRestriction, error) + RoleBindingRestrictionNamespaceListerExpansion +} + +// roleBindingRestrictionNamespaceLister implements the RoleBindingRestrictionNamespaceLister +// interface. +type roleBindingRestrictionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RoleBindingRestrictions in the indexer for a given namespace. +func (s roleBindingRestrictionNamespaceLister) List(selector labels.Selector) (ret []*v1.RoleBindingRestriction, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.RoleBindingRestriction)) + }) + return ret, err +} + +// Get retrieves the RoleBindingRestriction from the indexer for a given namespace and name. +func (s roleBindingRestrictionNamespaceLister) Get(name string) (*v1.RoleBindingRestriction, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("rolebindingrestriction"), name) + } + return obj.(*v1.RoleBindingRestriction), nil +} diff --git a/build/clientset/versioned/clientset.go b/build/clientset/versioned/clientset.go new file mode 100644 index 0000000000..2e6aab153b --- /dev/null +++ b/build/clientset/versioned/clientset.go @@ -0,0 +1,82 @@ +package versioned + +import ( + glog "github.com/golang/glog" + buildv1 "github.com/openshift/client-go/build/clientset/versioned/typed/build/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + BuildV1() buildv1.BuildV1Interface + // Deprecated: please explicitly pick a version if possible. + Build() buildv1.BuildV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + buildV1 *buildv1.BuildV1Client +} + +// BuildV1 retrieves the BuildV1Client +func (c *Clientset) BuildV1() buildv1.BuildV1Interface { + return c.buildV1 +} + +// Deprecated: Build retrieves the default version of BuildClient. +// Please explicitly pick a version. +func (c *Clientset) Build() buildv1.BuildV1Interface { + return c.buildV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.buildV1, err = buildv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.buildV1 = buildv1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.buildV1 = buildv1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/build/clientset/versioned/doc.go b/build/clientset/versioned/doc.go new file mode 100644 index 0000000000..72f92921e6 --- /dev/null +++ b/build/clientset/versioned/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated clientset. +package versioned diff --git a/build/clientset/versioned/fake/clientset_generated.go b/build/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..3f0bff412b --- /dev/null +++ b/build/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,55 @@ +package fake + +import ( + clientset "github.com/openshift/client-go/build/clientset/versioned" + buildv1 "github.com/openshift/client-go/build/clientset/versioned/typed/build/v1" + fakebuildv1 "github.com/openshift/client-go/build/clientset/versioned/typed/build/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := testing.Fake{} + fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) + fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// BuildV1 retrieves the BuildV1Client +func (c *Clientset) BuildV1() buildv1.BuildV1Interface { + return &fakebuildv1.FakeBuildV1{Fake: &c.Fake} +} + +// Build retrieves the BuildV1Client +func (c *Clientset) Build() buildv1.BuildV1Interface { + return &fakebuildv1.FakeBuildV1{Fake: &c.Fake} +} diff --git a/build/clientset/versioned/fake/doc.go b/build/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..760aaa8253 --- /dev/null +++ b/build/clientset/versioned/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated fake clientset. +package fake diff --git a/build/clientset/versioned/fake/register.go b/build/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..534e16c41e --- /dev/null +++ b/build/clientset/versioned/fake/register.go @@ -0,0 +1,37 @@ +package fake + +import ( + buildv1 "github.com/openshift/api/build/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + buildv1.AddToScheme(scheme) + +} diff --git a/build/clientset/versioned/scheme/doc.go b/build/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..d1c53d03b2 --- /dev/null +++ b/build/clientset/versioned/scheme/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/build/clientset/versioned/scheme/register.go b/build/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..7c34128a1b --- /dev/null +++ b/build/clientset/versioned/scheme/register.go @@ -0,0 +1,37 @@ +package scheme + +import ( + buildv1 "github.com/openshift/api/build/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + buildv1.AddToScheme(scheme) + +} diff --git a/build/clientset/versioned/typed/build/v1/build.go b/build/clientset/versioned/typed/build/v1/build.go new file mode 100644 index 0000000000..1449ce4cfa --- /dev/null +++ b/build/clientset/versioned/typed/build/v1/build.go @@ -0,0 +1,187 @@ +package v1 + +import ( + v1 "github.com/openshift/api/build/v1" + scheme "github.com/openshift/client-go/build/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// BuildsGetter has a method to return a BuildInterface. +// A group's client should implement this interface. +type BuildsGetter interface { + Builds(namespace string) BuildInterface +} + +// BuildInterface has methods to work with Build resources. +type BuildInterface interface { + Create(*v1.Build) (*v1.Build, error) + Update(*v1.Build) (*v1.Build, error) + UpdateStatus(*v1.Build) (*v1.Build, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.Build, error) + List(opts meta_v1.ListOptions) (*v1.BuildList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Build, err error) + UpdateDetails(buildName string, build *v1.Build) (*v1.Build, error) + Clone(buildName string, buildRequest *v1.BuildRequest) (*v1.Build, error) + + BuildExpansion +} + +// builds implements BuildInterface +type builds struct { + client rest.Interface + ns string +} + +// newBuilds returns a Builds +func newBuilds(c *BuildV1Client, namespace string) *builds { + return &builds{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the build, and returns the corresponding build object, and an error if there is any. +func (c *builds) Get(name string, options meta_v1.GetOptions) (result *v1.Build, err error) { + result = &v1.Build{} + err = c.client.Get(). + Namespace(c.ns). + Resource("builds"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Builds that match those selectors. +func (c *builds) List(opts meta_v1.ListOptions) (result *v1.BuildList, err error) { + result = &v1.BuildList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("builds"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested builds. +func (c *builds) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("builds"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a build and creates it. Returns the server's representation of the build, and an error, if there is any. +func (c *builds) Create(build *v1.Build) (result *v1.Build, err error) { + result = &v1.Build{} + err = c.client.Post(). + Namespace(c.ns). + Resource("builds"). + Body(build). + Do(). + Into(result) + return +} + +// Update takes the representation of a build and updates it. Returns the server's representation of the build, and an error, if there is any. +func (c *builds) Update(build *v1.Build) (result *v1.Build, err error) { + result = &v1.Build{} + err = c.client.Put(). + Namespace(c.ns). + Resource("builds"). + Name(build.Name). + Body(build). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *builds) UpdateStatus(build *v1.Build) (result *v1.Build, err error) { + result = &v1.Build{} + err = c.client.Put(). + Namespace(c.ns). + Resource("builds"). + Name(build.Name). + SubResource("status"). + Body(build). + Do(). + Into(result) + return +} + +// Delete takes name of the build and deletes it. Returns an error if one occurs. +func (c *builds) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("builds"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *builds) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("builds"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched build. +func (c *builds) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Build, err error) { + result = &v1.Build{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("builds"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} + +// UpdateDetails takes the top resource name and the representation of a build and updates it. Returns the server's representation of the build, and an error, if there is any. +func (c *builds) UpdateDetails(buildName string, build *v1.Build) (result *v1.Build, err error) { + result = &v1.Build{} + err = c.client.Put(). + Namespace(c.ns). + Resource("builds"). + Name(buildName). + SubResource("details"). + Body(build). + Do(). + Into(result) + return +} + +// Clone takes the representation of a buildRequest and creates it. Returns the server's representation of the build, and an error, if there is any. +func (c *builds) Clone(buildName string, buildRequest *v1.BuildRequest) (result *v1.Build, err error) { + result = &v1.Build{} + err = c.client.Post(). + Namespace(c.ns). + Resource("builds"). + Name(buildName). + SubResource("clone"). + Body(buildRequest). + Do(). + Into(result) + return +} diff --git a/build/clientset/versioned/typed/build/v1/build_client.go b/build/clientset/versioned/typed/build/v1/build_client.go new file mode 100644 index 0000000000..7adf49e58f --- /dev/null +++ b/build/clientset/versioned/typed/build/v1/build_client.go @@ -0,0 +1,77 @@ +package v1 + +import ( + v1 "github.com/openshift/api/build/v1" + "github.com/openshift/client-go/build/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type BuildV1Interface interface { + RESTClient() rest.Interface + BuildsGetter + BuildConfigsGetter +} + +// BuildV1Client is used to interact with features provided by the build.openshift.io group. +type BuildV1Client struct { + restClient rest.Interface +} + +func (c *BuildV1Client) Builds(namespace string) BuildInterface { + return newBuilds(c, namespace) +} + +func (c *BuildV1Client) BuildConfigs(namespace string) BuildConfigInterface { + return newBuildConfigs(c, namespace) +} + +// NewForConfig creates a new BuildV1Client for the given config. +func NewForConfig(c *rest.Config) (*BuildV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &BuildV1Client{client}, nil +} + +// NewForConfigOrDie creates a new BuildV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *BuildV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new BuildV1Client for the given RESTClient. +func New(c rest.Interface) *BuildV1Client { + return &BuildV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *BuildV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/build/clientset/versioned/typed/build/v1/buildconfig.go b/build/clientset/versioned/typed/build/v1/buildconfig.go new file mode 100644 index 0000000000..4478a7b5d0 --- /dev/null +++ b/build/clientset/versioned/typed/build/v1/buildconfig.go @@ -0,0 +1,172 @@ +package v1 + +import ( + v1 "github.com/openshift/api/build/v1" + scheme "github.com/openshift/client-go/build/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// BuildConfigsGetter has a method to return a BuildConfigInterface. +// A group's client should implement this interface. +type BuildConfigsGetter interface { + BuildConfigs(namespace string) BuildConfigInterface +} + +// BuildConfigInterface has methods to work with BuildConfig resources. +type BuildConfigInterface interface { + Create(*v1.BuildConfig) (*v1.BuildConfig, error) + Update(*v1.BuildConfig) (*v1.BuildConfig, error) + UpdateStatus(*v1.BuildConfig) (*v1.BuildConfig, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.BuildConfig, error) + List(opts meta_v1.ListOptions) (*v1.BuildConfigList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.BuildConfig, err error) + Instantiate(buildConfigName string, buildRequest *v1.BuildRequest) (*v1.Build, error) + + BuildConfigExpansion +} + +// buildConfigs implements BuildConfigInterface +type buildConfigs struct { + client rest.Interface + ns string +} + +// newBuildConfigs returns a BuildConfigs +func newBuildConfigs(c *BuildV1Client, namespace string) *buildConfigs { + return &buildConfigs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the buildConfig, and returns the corresponding buildConfig object, and an error if there is any. +func (c *buildConfigs) Get(name string, options meta_v1.GetOptions) (result *v1.BuildConfig, err error) { + result = &v1.BuildConfig{} + err = c.client.Get(). + Namespace(c.ns). + Resource("buildconfigs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of BuildConfigs that match those selectors. +func (c *buildConfigs) List(opts meta_v1.ListOptions) (result *v1.BuildConfigList, err error) { + result = &v1.BuildConfigList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("buildconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested buildConfigs. +func (c *buildConfigs) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("buildconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a buildConfig and creates it. Returns the server's representation of the buildConfig, and an error, if there is any. +func (c *buildConfigs) Create(buildConfig *v1.BuildConfig) (result *v1.BuildConfig, err error) { + result = &v1.BuildConfig{} + err = c.client.Post(). + Namespace(c.ns). + Resource("buildconfigs"). + Body(buildConfig). + Do(). + Into(result) + return +} + +// Update takes the representation of a buildConfig and updates it. Returns the server's representation of the buildConfig, and an error, if there is any. +func (c *buildConfigs) Update(buildConfig *v1.BuildConfig) (result *v1.BuildConfig, err error) { + result = &v1.BuildConfig{} + err = c.client.Put(). + Namespace(c.ns). + Resource("buildconfigs"). + Name(buildConfig.Name). + Body(buildConfig). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *buildConfigs) UpdateStatus(buildConfig *v1.BuildConfig) (result *v1.BuildConfig, err error) { + result = &v1.BuildConfig{} + err = c.client.Put(). + Namespace(c.ns). + Resource("buildconfigs"). + Name(buildConfig.Name). + SubResource("status"). + Body(buildConfig). + Do(). + Into(result) + return +} + +// Delete takes name of the buildConfig and deletes it. Returns an error if one occurs. +func (c *buildConfigs) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("buildconfigs"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *buildConfigs) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("buildconfigs"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched buildConfig. +func (c *buildConfigs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.BuildConfig, err error) { + result = &v1.BuildConfig{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("buildconfigs"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} + +// Instantiate takes the representation of a buildRequest and creates it. Returns the server's representation of the build, and an error, if there is any. +func (c *buildConfigs) Instantiate(buildConfigName string, buildRequest *v1.BuildRequest) (result *v1.Build, err error) { + result = &v1.Build{} + err = c.client.Post(). + Namespace(c.ns). + Resource("buildconfigs"). + Name(buildConfigName). + SubResource("instantiate"). + Body(buildRequest). + Do(). + Into(result) + return +} diff --git a/build/clientset/versioned/typed/build/v1/doc.go b/build/clientset/versioned/typed/build/v1/doc.go new file mode 100644 index 0000000000..0e93c2c5e7 --- /dev/null +++ b/build/clientset/versioned/typed/build/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated typed clients. +package v1 diff --git a/build/clientset/versioned/typed/build/v1/fake/doc.go b/build/clientset/versioned/typed/build/v1/fake/doc.go new file mode 100644 index 0000000000..e3bbd12a2b --- /dev/null +++ b/build/clientset/versioned/typed/build/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// Package fake has the automatically generated clients. +package fake diff --git a/build/clientset/versioned/typed/build/v1/fake/fake_build.go b/build/clientset/versioned/typed/build/v1/fake/fake_build.go new file mode 100644 index 0000000000..941369e276 --- /dev/null +++ b/build/clientset/versioned/typed/build/v1/fake/fake_build.go @@ -0,0 +1,144 @@ +package fake + +import ( + build_v1 "github.com/openshift/api/build/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeBuilds implements BuildInterface +type FakeBuilds struct { + Fake *FakeBuildV1 + ns string +} + +var buildsResource = schema.GroupVersionResource{Group: "build.openshift.io", Version: "v1", Resource: "builds"} + +var buildsKind = schema.GroupVersionKind{Group: "build.openshift.io", Version: "v1", Kind: "Build"} + +// Get takes name of the build, and returns the corresponding build object, and an error if there is any. +func (c *FakeBuilds) Get(name string, options v1.GetOptions) (result *build_v1.Build, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(buildsResource, c.ns, name), &build_v1.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*build_v1.Build), err +} + +// List takes label and field selectors, and returns the list of Builds that match those selectors. +func (c *FakeBuilds) List(opts v1.ListOptions) (result *build_v1.BuildList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(buildsResource, buildsKind, c.ns, opts), &build_v1.BuildList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &build_v1.BuildList{} + for _, item := range obj.(*build_v1.BuildList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested builds. +func (c *FakeBuilds) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(buildsResource, c.ns, opts)) + +} + +// Create takes the representation of a build and creates it. Returns the server's representation of the build, and an error, if there is any. +func (c *FakeBuilds) Create(build *build_v1.Build) (result *build_v1.Build, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(buildsResource, c.ns, build), &build_v1.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*build_v1.Build), err +} + +// Update takes the representation of a build and updates it. Returns the server's representation of the build, and an error, if there is any. +func (c *FakeBuilds) Update(build *build_v1.Build) (result *build_v1.Build, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(buildsResource, c.ns, build), &build_v1.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*build_v1.Build), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeBuilds) UpdateStatus(build *build_v1.Build) (*build_v1.Build, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(buildsResource, "status", c.ns, build), &build_v1.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*build_v1.Build), err +} + +// Delete takes name of the build and deletes it. Returns an error if one occurs. +func (c *FakeBuilds) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(buildsResource, c.ns, name), &build_v1.Build{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeBuilds) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(buildsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &build_v1.BuildList{}) + return err +} + +// Patch applies the patch and returns the patched build. +func (c *FakeBuilds) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *build_v1.Build, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(buildsResource, c.ns, name, data, subresources...), &build_v1.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*build_v1.Build), err +} + +// UpdateDetails takes the representation of a build and updates it. Returns the server's representation of the build, and an error, if there is any. +func (c *FakeBuilds) UpdateDetails(buildName string, build *build_v1.Build) (result *build_v1.Build, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(buildsResource, "details", c.ns, build), &build_v1.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*build_v1.Build), err +} + +// Clone takes the representation of a buildRequest and creates it. Returns the server's representation of the build, and an error, if there is any. +func (c *FakeBuilds) Clone(buildName string, buildRequest *build_v1.BuildRequest) (result *build_v1.Build, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateSubresourceAction(buildsResource, buildName, "clone", c.ns, buildRequest), &build_v1.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*build_v1.Build), err +} diff --git a/build/clientset/versioned/typed/build/v1/fake/fake_build_client.go b/build/clientset/versioned/typed/build/v1/fake/fake_build_client.go new file mode 100644 index 0000000000..b9d8d79109 --- /dev/null +++ b/build/clientset/versioned/typed/build/v1/fake/fake_build_client.go @@ -0,0 +1,26 @@ +package fake + +import ( + v1 "github.com/openshift/client-go/build/clientset/versioned/typed/build/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeBuildV1 struct { + *testing.Fake +} + +func (c *FakeBuildV1) Builds(namespace string) v1.BuildInterface { + return &FakeBuilds{c, namespace} +} + +func (c *FakeBuildV1) BuildConfigs(namespace string) v1.BuildConfigInterface { + return &FakeBuildConfigs{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeBuildV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/build/clientset/versioned/typed/build/v1/fake/fake_buildconfig.go b/build/clientset/versioned/typed/build/v1/fake/fake_buildconfig.go new file mode 100644 index 0000000000..57894cba6d --- /dev/null +++ b/build/clientset/versioned/typed/build/v1/fake/fake_buildconfig.go @@ -0,0 +1,133 @@ +package fake + +import ( + build_v1 "github.com/openshift/api/build/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeBuildConfigs implements BuildConfigInterface +type FakeBuildConfigs struct { + Fake *FakeBuildV1 + ns string +} + +var buildconfigsResource = schema.GroupVersionResource{Group: "build.openshift.io", Version: "v1", Resource: "buildconfigs"} + +var buildconfigsKind = schema.GroupVersionKind{Group: "build.openshift.io", Version: "v1", Kind: "BuildConfig"} + +// Get takes name of the buildConfig, and returns the corresponding buildConfig object, and an error if there is any. +func (c *FakeBuildConfigs) Get(name string, options v1.GetOptions) (result *build_v1.BuildConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(buildconfigsResource, c.ns, name), &build_v1.BuildConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*build_v1.BuildConfig), err +} + +// List takes label and field selectors, and returns the list of BuildConfigs that match those selectors. +func (c *FakeBuildConfigs) List(opts v1.ListOptions) (result *build_v1.BuildConfigList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(buildconfigsResource, buildconfigsKind, c.ns, opts), &build_v1.BuildConfigList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &build_v1.BuildConfigList{} + for _, item := range obj.(*build_v1.BuildConfigList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested buildConfigs. +func (c *FakeBuildConfigs) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(buildconfigsResource, c.ns, opts)) + +} + +// Create takes the representation of a buildConfig and creates it. Returns the server's representation of the buildConfig, and an error, if there is any. +func (c *FakeBuildConfigs) Create(buildConfig *build_v1.BuildConfig) (result *build_v1.BuildConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(buildconfigsResource, c.ns, buildConfig), &build_v1.BuildConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*build_v1.BuildConfig), err +} + +// Update takes the representation of a buildConfig and updates it. Returns the server's representation of the buildConfig, and an error, if there is any. +func (c *FakeBuildConfigs) Update(buildConfig *build_v1.BuildConfig) (result *build_v1.BuildConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(buildconfigsResource, c.ns, buildConfig), &build_v1.BuildConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*build_v1.BuildConfig), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeBuildConfigs) UpdateStatus(buildConfig *build_v1.BuildConfig) (*build_v1.BuildConfig, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(buildconfigsResource, "status", c.ns, buildConfig), &build_v1.BuildConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*build_v1.BuildConfig), err +} + +// Delete takes name of the buildConfig and deletes it. Returns an error if one occurs. +func (c *FakeBuildConfigs) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(buildconfigsResource, c.ns, name), &build_v1.BuildConfig{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeBuildConfigs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(buildconfigsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &build_v1.BuildConfigList{}) + return err +} + +// Patch applies the patch and returns the patched buildConfig. +func (c *FakeBuildConfigs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *build_v1.BuildConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(buildconfigsResource, c.ns, name, data, subresources...), &build_v1.BuildConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*build_v1.BuildConfig), err +} + +// Instantiate takes the representation of a buildRequest and creates it. Returns the server's representation of the build, and an error, if there is any. +func (c *FakeBuildConfigs) Instantiate(buildConfigName string, buildRequest *build_v1.BuildRequest) (result *build_v1.Build, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateSubresourceAction(buildconfigsResource, buildConfigName, "instantiate", c.ns, buildRequest), &build_v1.Build{}) + + if obj == nil { + return nil, err + } + return obj.(*build_v1.Build), err +} diff --git a/build/clientset/versioned/typed/build/v1/generated_expansion.go b/build/clientset/versioned/typed/build/v1/generated_expansion.go new file mode 100644 index 0000000000..1479d07cdc --- /dev/null +++ b/build/clientset/versioned/typed/build/v1/generated_expansion.go @@ -0,0 +1,5 @@ +package v1 + +type BuildExpansion interface{} + +type BuildConfigExpansion interface{} diff --git a/build/informers/externalversions/build/interface.go b/build/informers/externalversions/build/interface.go new file mode 100644 index 0000000000..19d30157c5 --- /dev/null +++ b/build/informers/externalversions/build/interface.go @@ -0,0 +1,28 @@ +// This file was automatically generated by informer-gen + +package build + +import ( + v1 "github.com/openshift/client-go/build/informers/externalversions/build/v1" + internalinterfaces "github.com/openshift/client-go/build/informers/externalversions/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &group{f} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.SharedInformerFactory) +} diff --git a/build/informers/externalversions/build/v1/build.go b/build/informers/externalversions/build/v1/build.go new file mode 100644 index 0000000000..c89bc421e0 --- /dev/null +++ b/build/informers/externalversions/build/v1/build.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + build_v1 "github.com/openshift/api/build/v1" + versioned "github.com/openshift/client-go/build/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/build/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/build/listers/build/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// BuildInformer provides access to a shared informer and lister for +// Builds. +type BuildInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.BuildLister +} + +type buildInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewBuildInformer constructs a new informer for Build type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewBuildInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.BuildV1().Builds(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.BuildV1().Builds(namespace).Watch(options) + }, + }, + &build_v1.Build{}, + resyncPeriod, + indexers, + ) +} + +func defaultBuildInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewBuildInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *buildInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&build_v1.Build{}, defaultBuildInformer) +} + +func (f *buildInformer) Lister() v1.BuildLister { + return v1.NewBuildLister(f.Informer().GetIndexer()) +} diff --git a/build/informers/externalversions/build/v1/buildconfig.go b/build/informers/externalversions/build/v1/buildconfig.go new file mode 100644 index 0000000000..585184967a --- /dev/null +++ b/build/informers/externalversions/build/v1/buildconfig.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + build_v1 "github.com/openshift/api/build/v1" + versioned "github.com/openshift/client-go/build/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/build/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/build/listers/build/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// BuildConfigInformer provides access to a shared informer and lister for +// BuildConfigs. +type BuildConfigInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.BuildConfigLister +} + +type buildConfigInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewBuildConfigInformer constructs a new informer for BuildConfig type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewBuildConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.BuildV1().BuildConfigs(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.BuildV1().BuildConfigs(namespace).Watch(options) + }, + }, + &build_v1.BuildConfig{}, + resyncPeriod, + indexers, + ) +} + +func defaultBuildConfigInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewBuildConfigInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *buildConfigInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&build_v1.BuildConfig{}, defaultBuildConfigInformer) +} + +func (f *buildConfigInformer) Lister() v1.BuildConfigLister { + return v1.NewBuildConfigLister(f.Informer().GetIndexer()) +} diff --git a/build/informers/externalversions/build/v1/interface.go b/build/informers/externalversions/build/v1/interface.go new file mode 100644 index 0000000000..9821751693 --- /dev/null +++ b/build/informers/externalversions/build/v1/interface.go @@ -0,0 +1,34 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + internalinterfaces "github.com/openshift/client-go/build/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Builds returns a BuildInformer. + Builds() BuildInformer + // BuildConfigs returns a BuildConfigInformer. + BuildConfigs() BuildConfigInformer +} + +type version struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &version{f} +} + +// Builds returns a BuildInformer. +func (v *version) Builds() BuildInformer { + return &buildInformer{factory: v.SharedInformerFactory} +} + +// BuildConfigs returns a BuildConfigInformer. +func (v *version) BuildConfigs() BuildConfigInformer { + return &buildConfigInformer{factory: v.SharedInformerFactory} +} diff --git a/build/informers/externalversions/factory.go b/build/informers/externalversions/factory.go new file mode 100644 index 0000000000..65b29e43dd --- /dev/null +++ b/build/informers/externalversions/factory.go @@ -0,0 +1,102 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + versioned "github.com/openshift/client-go/build/clientset/versioned" + build "github.com/openshift/client-go/build/informers/externalversions/build" + internalinterfaces "github.com/openshift/client-go/build/informers/externalversions/internalinterfaces" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + reflect "reflect" + sync "sync" + time "time" +) + +type sharedInformerFactory struct { + client versioned.Interface + lock sync.Mutex + defaultResync time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return &sharedInformerFactory{ + client: client, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + } +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + informer = newFunc(f.client, f.defaultResync) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Build() build.Interface +} + +func (f *sharedInformerFactory) Build() build.Interface { + return build.New(f) +} diff --git a/build/informers/externalversions/generic.go b/build/informers/externalversions/generic.go new file mode 100644 index 0000000000..f24f14b1f2 --- /dev/null +++ b/build/informers/externalversions/generic.go @@ -0,0 +1,47 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + "fmt" + v1 "github.com/openshift/api/build/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=Build, Version=V1 + case v1.SchemeGroupVersion.WithResource("builds"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Build().V1().Builds().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("buildconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Build().V1().BuildConfigs().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/build/informers/externalversions/internalinterfaces/factory_interfaces.go b/build/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..faf615d5bc --- /dev/null +++ b/build/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,18 @@ +// This file was automatically generated by informer-gen + +package internalinterfaces + +import ( + versioned "github.com/openshift/client-go/build/clientset/versioned" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} diff --git a/build/listers/build/v1/build.go b/build/listers/build/v1/build.go new file mode 100644 index 0000000000..ffa98526d2 --- /dev/null +++ b/build/listers/build/v1/build.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/build/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// BuildLister helps list Builds. +type BuildLister interface { + // List lists all Builds in the indexer. + List(selector labels.Selector) (ret []*v1.Build, err error) + // Builds returns an object that can list and get Builds. + Builds(namespace string) BuildNamespaceLister + BuildListerExpansion +} + +// buildLister implements the BuildLister interface. +type buildLister struct { + indexer cache.Indexer +} + +// NewBuildLister returns a new BuildLister. +func NewBuildLister(indexer cache.Indexer) BuildLister { + return &buildLister{indexer: indexer} +} + +// List lists all Builds in the indexer. +func (s *buildLister) List(selector labels.Selector) (ret []*v1.Build, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Build)) + }) + return ret, err +} + +// Builds returns an object that can list and get Builds. +func (s *buildLister) Builds(namespace string) BuildNamespaceLister { + return buildNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// BuildNamespaceLister helps list and get Builds. +type BuildNamespaceLister interface { + // List lists all Builds in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.Build, err error) + // Get retrieves the Build from the indexer for a given namespace and name. + Get(name string) (*v1.Build, error) + BuildNamespaceListerExpansion +} + +// buildNamespaceLister implements the BuildNamespaceLister +// interface. +type buildNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Builds in the indexer for a given namespace. +func (s buildNamespaceLister) List(selector labels.Selector) (ret []*v1.Build, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Build)) + }) + return ret, err +} + +// Get retrieves the Build from the indexer for a given namespace and name. +func (s buildNamespaceLister) Get(name string) (*v1.Build, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("build"), name) + } + return obj.(*v1.Build), nil +} diff --git a/build/listers/build/v1/buildconfig.go b/build/listers/build/v1/buildconfig.go new file mode 100644 index 0000000000..5c3031ff37 --- /dev/null +++ b/build/listers/build/v1/buildconfig.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/build/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// BuildConfigLister helps list BuildConfigs. +type BuildConfigLister interface { + // List lists all BuildConfigs in the indexer. + List(selector labels.Selector) (ret []*v1.BuildConfig, err error) + // BuildConfigs returns an object that can list and get BuildConfigs. + BuildConfigs(namespace string) BuildConfigNamespaceLister + BuildConfigListerExpansion +} + +// buildConfigLister implements the BuildConfigLister interface. +type buildConfigLister struct { + indexer cache.Indexer +} + +// NewBuildConfigLister returns a new BuildConfigLister. +func NewBuildConfigLister(indexer cache.Indexer) BuildConfigLister { + return &buildConfigLister{indexer: indexer} +} + +// List lists all BuildConfigs in the indexer. +func (s *buildConfigLister) List(selector labels.Selector) (ret []*v1.BuildConfig, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.BuildConfig)) + }) + return ret, err +} + +// BuildConfigs returns an object that can list and get BuildConfigs. +func (s *buildConfigLister) BuildConfigs(namespace string) BuildConfigNamespaceLister { + return buildConfigNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// BuildConfigNamespaceLister helps list and get BuildConfigs. +type BuildConfigNamespaceLister interface { + // List lists all BuildConfigs in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.BuildConfig, err error) + // Get retrieves the BuildConfig from the indexer for a given namespace and name. + Get(name string) (*v1.BuildConfig, error) + BuildConfigNamespaceListerExpansion +} + +// buildConfigNamespaceLister implements the BuildConfigNamespaceLister +// interface. +type buildConfigNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all BuildConfigs in the indexer for a given namespace. +func (s buildConfigNamespaceLister) List(selector labels.Selector) (ret []*v1.BuildConfig, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.BuildConfig)) + }) + return ret, err +} + +// Get retrieves the BuildConfig from the indexer for a given namespace and name. +func (s buildConfigNamespaceLister) Get(name string) (*v1.BuildConfig, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("buildconfig"), name) + } + return obj.(*v1.BuildConfig), nil +} diff --git a/build/listers/build/v1/expansion_generated.go b/build/listers/build/v1/expansion_generated.go new file mode 100644 index 0000000000..112183b85f --- /dev/null +++ b/build/listers/build/v1/expansion_generated.go @@ -0,0 +1,19 @@ +// This file was automatically generated by lister-gen + +package v1 + +// BuildListerExpansion allows custom methods to be added to +// BuildLister. +type BuildListerExpansion interface{} + +// BuildNamespaceListerExpansion allows custom methods to be added to +// BuildNamespaceLister. +type BuildNamespaceListerExpansion interface{} + +// BuildConfigListerExpansion allows custom methods to be added to +// BuildConfigLister. +type BuildConfigListerExpansion interface{} + +// BuildConfigNamespaceListerExpansion allows custom methods to be added to +// BuildConfigNamespaceLister. +type BuildConfigNamespaceListerExpansion interface{} diff --git a/image/clientset/versioned/clientset.go b/image/clientset/versioned/clientset.go new file mode 100644 index 0000000000..de7a8f10f9 --- /dev/null +++ b/image/clientset/versioned/clientset.go @@ -0,0 +1,82 @@ +package versioned + +import ( + glog "github.com/golang/glog" + imagev1 "github.com/openshift/client-go/image/clientset/versioned/typed/image/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + ImageV1() imagev1.ImageV1Interface + // Deprecated: please explicitly pick a version if possible. + Image() imagev1.ImageV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + imageV1 *imagev1.ImageV1Client +} + +// ImageV1 retrieves the ImageV1Client +func (c *Clientset) ImageV1() imagev1.ImageV1Interface { + return c.imageV1 +} + +// Deprecated: Image retrieves the default version of ImageClient. +// Please explicitly pick a version. +func (c *Clientset) Image() imagev1.ImageV1Interface { + return c.imageV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.imageV1, err = imagev1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.imageV1 = imagev1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.imageV1 = imagev1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/image/clientset/versioned/doc.go b/image/clientset/versioned/doc.go new file mode 100644 index 0000000000..72f92921e6 --- /dev/null +++ b/image/clientset/versioned/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated clientset. +package versioned diff --git a/image/clientset/versioned/fake/clientset_generated.go b/image/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..a7734c9fc3 --- /dev/null +++ b/image/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,55 @@ +package fake + +import ( + clientset "github.com/openshift/client-go/image/clientset/versioned" + imagev1 "github.com/openshift/client-go/image/clientset/versioned/typed/image/v1" + fakeimagev1 "github.com/openshift/client-go/image/clientset/versioned/typed/image/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := testing.Fake{} + fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) + fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// ImageV1 retrieves the ImageV1Client +func (c *Clientset) ImageV1() imagev1.ImageV1Interface { + return &fakeimagev1.FakeImageV1{Fake: &c.Fake} +} + +// Image retrieves the ImageV1Client +func (c *Clientset) Image() imagev1.ImageV1Interface { + return &fakeimagev1.FakeImageV1{Fake: &c.Fake} +} diff --git a/image/clientset/versioned/fake/doc.go b/image/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..760aaa8253 --- /dev/null +++ b/image/clientset/versioned/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated fake clientset. +package fake diff --git a/image/clientset/versioned/fake/register.go b/image/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..0a5cd007ed --- /dev/null +++ b/image/clientset/versioned/fake/register.go @@ -0,0 +1,37 @@ +package fake + +import ( + imagev1 "github.com/openshift/api/image/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + imagev1.AddToScheme(scheme) + +} diff --git a/image/clientset/versioned/scheme/doc.go b/image/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..d1c53d03b2 --- /dev/null +++ b/image/clientset/versioned/scheme/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/image/clientset/versioned/scheme/register.go b/image/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..148047bd69 --- /dev/null +++ b/image/clientset/versioned/scheme/register.go @@ -0,0 +1,37 @@ +package scheme + +import ( + imagev1 "github.com/openshift/api/image/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + imagev1.AddToScheme(scheme) + +} diff --git a/image/clientset/versioned/typed/image/v1/doc.go b/image/clientset/versioned/typed/image/v1/doc.go new file mode 100644 index 0000000000..0e93c2c5e7 --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated typed clients. +package v1 diff --git a/image/clientset/versioned/typed/image/v1/fake/doc.go b/image/clientset/versioned/typed/image/v1/fake/doc.go new file mode 100644 index 0000000000..e3bbd12a2b --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// Package fake has the automatically generated clients. +package fake diff --git a/image/clientset/versioned/typed/image/v1/fake/fake_image.go b/image/clientset/versioned/typed/image/v1/fake/fake_image.go new file mode 100644 index 0000000000..692bbf606c --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/fake/fake_image.go @@ -0,0 +1,102 @@ +package fake + +import ( + image_v1 "github.com/openshift/api/image/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeImages implements ImageInterface +type FakeImages struct { + Fake *FakeImageV1 +} + +var imagesResource = schema.GroupVersionResource{Group: "image.openshift.io", Version: "v1", Resource: "images"} + +var imagesKind = schema.GroupVersionKind{Group: "image.openshift.io", Version: "v1", Kind: "Image"} + +// Get takes name of the image, and returns the corresponding image object, and an error if there is any. +func (c *FakeImages) Get(name string, options v1.GetOptions) (result *image_v1.Image, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(imagesResource, name), &image_v1.Image{}) + if obj == nil { + return nil, err + } + return obj.(*image_v1.Image), err +} + +// List takes label and field selectors, and returns the list of Images that match those selectors. +func (c *FakeImages) List(opts v1.ListOptions) (result *image_v1.ImageList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(imagesResource, imagesKind, opts), &image_v1.ImageList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &image_v1.ImageList{} + for _, item := range obj.(*image_v1.ImageList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested images. +func (c *FakeImages) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(imagesResource, opts)) +} + +// Create takes the representation of a image and creates it. Returns the server's representation of the image, and an error, if there is any. +func (c *FakeImages) Create(image *image_v1.Image) (result *image_v1.Image, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(imagesResource, image), &image_v1.Image{}) + if obj == nil { + return nil, err + } + return obj.(*image_v1.Image), err +} + +// Update takes the representation of a image and updates it. Returns the server's representation of the image, and an error, if there is any. +func (c *FakeImages) Update(image *image_v1.Image) (result *image_v1.Image, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(imagesResource, image), &image_v1.Image{}) + if obj == nil { + return nil, err + } + return obj.(*image_v1.Image), err +} + +// Delete takes name of the image and deletes it. Returns an error if one occurs. +func (c *FakeImages) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(imagesResource, name), &image_v1.Image{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeImages) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(imagesResource, listOptions) + + _, err := c.Fake.Invokes(action, &image_v1.ImageList{}) + return err +} + +// Patch applies the patch and returns the patched image. +func (c *FakeImages) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *image_v1.Image, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(imagesResource, name, data, subresources...), &image_v1.Image{}) + if obj == nil { + return nil, err + } + return obj.(*image_v1.Image), err +} diff --git a/image/clientset/versioned/typed/image/v1/fake/fake_image_client.go b/image/clientset/versioned/typed/image/v1/fake/fake_image_client.go new file mode 100644 index 0000000000..8c31793bba --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/fake/fake_image_client.go @@ -0,0 +1,46 @@ +package fake + +import ( + v1 "github.com/openshift/client-go/image/clientset/versioned/typed/image/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeImageV1 struct { + *testing.Fake +} + +func (c *FakeImageV1) Images() v1.ImageInterface { + return &FakeImages{c} +} + +func (c *FakeImageV1) ImageSignatures() v1.ImageSignatureInterface { + return &FakeImageSignatures{c} +} + +func (c *FakeImageV1) ImageStreams(namespace string) v1.ImageStreamInterface { + return &FakeImageStreams{c, namespace} +} + +func (c *FakeImageV1) ImageStreamImages(namespace string) v1.ImageStreamImageInterface { + return &FakeImageStreamImages{c, namespace} +} + +func (c *FakeImageV1) ImageStreamImports(namespace string) v1.ImageStreamImportInterface { + return &FakeImageStreamImports{c, namespace} +} + +func (c *FakeImageV1) ImageStreamMappings(namespace string) v1.ImageStreamMappingInterface { + return &FakeImageStreamMappings{c, namespace} +} + +func (c *FakeImageV1) ImageStreamTags(namespace string) v1.ImageStreamTagInterface { + return &FakeImageStreamTags{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeImageV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/image/clientset/versioned/typed/image/v1/fake/fake_imagesignature.go b/image/clientset/versioned/typed/image/v1/fake/fake_imagesignature.go new file mode 100644 index 0000000000..f7c61504ab --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/fake/fake_imagesignature.go @@ -0,0 +1,34 @@ +package fake + +import ( + v1 "github.com/openshift/api/image/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeImageSignatures implements ImageSignatureInterface +type FakeImageSignatures struct { + Fake *FakeImageV1 +} + +var imagesignaturesResource = schema.GroupVersionResource{Group: "image.openshift.io", Version: "v1", Resource: "imagesignatures"} + +var imagesignaturesKind = schema.GroupVersionKind{Group: "image.openshift.io", Version: "v1", Kind: "ImageSignature"} + +// Create takes the representation of a imageSignature and creates it. Returns the server's representation of the imageSignature, and an error, if there is any. +func (c *FakeImageSignatures) Create(imageSignature *v1.ImageSignature) (result *v1.ImageSignature, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(imagesignaturesResource, imageSignature), &v1.ImageSignature{}) + if obj == nil { + return nil, err + } + return obj.(*v1.ImageSignature), err +} + +// Delete takes name of the imageSignature and deletes it. Returns an error if one occurs. +func (c *FakeImageSignatures) Delete(name string, options *meta_v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(imagesignaturesResource, name), &v1.ImageSignature{}) + return err +} diff --git a/image/clientset/versioned/typed/image/v1/fake/fake_imagestream.go b/image/clientset/versioned/typed/image/v1/fake/fake_imagestream.go new file mode 100644 index 0000000000..1e3f1077b5 --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/fake/fake_imagestream.go @@ -0,0 +1,134 @@ +package fake + +import ( + image_v1 "github.com/openshift/api/image/v1" + core_v1 "k8s.io/api/core/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeImageStreams implements ImageStreamInterface +type FakeImageStreams struct { + Fake *FakeImageV1 + ns string +} + +var imagestreamsResource = schema.GroupVersionResource{Group: "image.openshift.io", Version: "v1", Resource: "imagestreams"} + +var imagestreamsKind = schema.GroupVersionKind{Group: "image.openshift.io", Version: "v1", Kind: "ImageStream"} + +// Get takes name of the imageStream, and returns the corresponding imageStream object, and an error if there is any. +func (c *FakeImageStreams) Get(name string, options v1.GetOptions) (result *image_v1.ImageStream, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(imagestreamsResource, c.ns, name), &image_v1.ImageStream{}) + + if obj == nil { + return nil, err + } + return obj.(*image_v1.ImageStream), err +} + +// List takes label and field selectors, and returns the list of ImageStreams that match those selectors. +func (c *FakeImageStreams) List(opts v1.ListOptions) (result *image_v1.ImageStreamList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(imagestreamsResource, imagestreamsKind, c.ns, opts), &image_v1.ImageStreamList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &image_v1.ImageStreamList{} + for _, item := range obj.(*image_v1.ImageStreamList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested imageStreams. +func (c *FakeImageStreams) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(imagestreamsResource, c.ns, opts)) + +} + +// Create takes the representation of a imageStream and creates it. Returns the server's representation of the imageStream, and an error, if there is any. +func (c *FakeImageStreams) Create(imageStream *image_v1.ImageStream) (result *image_v1.ImageStream, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(imagestreamsResource, c.ns, imageStream), &image_v1.ImageStream{}) + + if obj == nil { + return nil, err + } + return obj.(*image_v1.ImageStream), err +} + +// Update takes the representation of a imageStream and updates it. Returns the server's representation of the imageStream, and an error, if there is any. +func (c *FakeImageStreams) Update(imageStream *image_v1.ImageStream) (result *image_v1.ImageStream, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(imagestreamsResource, c.ns, imageStream), &image_v1.ImageStream{}) + + if obj == nil { + return nil, err + } + return obj.(*image_v1.ImageStream), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeImageStreams) UpdateStatus(imageStream *image_v1.ImageStream) (*image_v1.ImageStream, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(imagestreamsResource, "status", c.ns, imageStream), &image_v1.ImageStream{}) + + if obj == nil { + return nil, err + } + return obj.(*image_v1.ImageStream), err +} + +// Delete takes name of the imageStream and deletes it. Returns an error if one occurs. +func (c *FakeImageStreams) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(imagestreamsResource, c.ns, name), &image_v1.ImageStream{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeImageStreams) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(imagestreamsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &image_v1.ImageStreamList{}) + return err +} + +// Patch applies the patch and returns the patched imageStream. +func (c *FakeImageStreams) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *image_v1.ImageStream, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(imagestreamsResource, c.ns, name, data, subresources...), &image_v1.ImageStream{}) + + if obj == nil { + return nil, err + } + return obj.(*image_v1.ImageStream), err +} + +// Secrets takes label and field selectors, and returns the list of Secrets that match those selectors. +func (c *FakeImageStreams) Secrets(imageStreamName string, opts v1.ListOptions) (result *core_v1.SecretList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListSubresourceAction(imagestreamsResource, imageStreamName, "secrets", imagestreamsKind, c.ns, opts), &core_v1.SecretList{}) + + if obj == nil { + return nil, err + } + return obj.(*core_v1.SecretList), err +} diff --git a/image/clientset/versioned/typed/image/v1/fake/fake_imagestreamimage.go b/image/clientset/versioned/typed/image/v1/fake/fake_imagestreamimage.go new file mode 100644 index 0000000000..a7dd685941 --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/fake/fake_imagestreamimage.go @@ -0,0 +1,29 @@ +package fake + +import ( + image_v1 "github.com/openshift/api/image/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeImageStreamImages implements ImageStreamImageInterface +type FakeImageStreamImages struct { + Fake *FakeImageV1 + ns string +} + +var imagestreamimagesResource = schema.GroupVersionResource{Group: "image.openshift.io", Version: "v1", Resource: "imagestreamimages"} + +var imagestreamimagesKind = schema.GroupVersionKind{Group: "image.openshift.io", Version: "v1", Kind: "ImageStreamImage"} + +// Get takes name of the imageStreamImage, and returns the corresponding imageStreamImage object, and an error if there is any. +func (c *FakeImageStreamImages) Get(name string, options v1.GetOptions) (result *image_v1.ImageStreamImage, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(imagestreamimagesResource, c.ns, name), &image_v1.ImageStreamImage{}) + + if obj == nil { + return nil, err + } + return obj.(*image_v1.ImageStreamImage), err +} diff --git a/image/clientset/versioned/typed/image/v1/fake/fake_imagestreamimport.go b/image/clientset/versioned/typed/image/v1/fake/fake_imagestreamimport.go new file mode 100644 index 0000000000..3b066ba64f --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/fake/fake_imagestreamimport.go @@ -0,0 +1,28 @@ +package fake + +import ( + v1 "github.com/openshift/api/image/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeImageStreamImports implements ImageStreamImportInterface +type FakeImageStreamImports struct { + Fake *FakeImageV1 + ns string +} + +var imagestreamimportsResource = schema.GroupVersionResource{Group: "image.openshift.io", Version: "v1", Resource: "imagestreamimports"} + +var imagestreamimportsKind = schema.GroupVersionKind{Group: "image.openshift.io", Version: "v1", Kind: "ImageStreamImport"} + +// Create takes the representation of a imageStreamImport and creates it. Returns the server's representation of the imageStreamImport, and an error, if there is any. +func (c *FakeImageStreamImports) Create(imageStreamImport *v1.ImageStreamImport) (result *v1.ImageStreamImport, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(imagestreamimportsResource, c.ns, imageStreamImport), &v1.ImageStreamImport{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.ImageStreamImport), err +} diff --git a/image/clientset/versioned/typed/image/v1/fake/fake_imagestreammapping.go b/image/clientset/versioned/typed/image/v1/fake/fake_imagestreammapping.go new file mode 100644 index 0000000000..38c1c116ce --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/fake/fake_imagestreammapping.go @@ -0,0 +1,29 @@ +package fake + +import ( + v1 "github.com/openshift/api/image/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeImageStreamMappings implements ImageStreamMappingInterface +type FakeImageStreamMappings struct { + Fake *FakeImageV1 + ns string +} + +var imagestreammappingsResource = schema.GroupVersionResource{Group: "image.openshift.io", Version: "v1", Resource: "imagestreammappings"} + +var imagestreammappingsKind = schema.GroupVersionKind{Group: "image.openshift.io", Version: "v1", Kind: "ImageStreamMapping"} + +// Create takes the representation of a imageStreamMapping and creates it. Returns the server's representation of the status, and an error, if there is any. +func (c *FakeImageStreamMappings) Create(imageStreamMapping *v1.ImageStreamMapping) (result *meta_v1.Status, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(imagestreammappingsResource, c.ns, imageStreamMapping), &meta_v1.Status{}) + + if obj == nil { + return nil, err + } + return obj.(*meta_v1.Status), err +} diff --git a/image/clientset/versioned/typed/image/v1/fake/fake_imagestreamtag.go b/image/clientset/versioned/typed/image/v1/fake/fake_imagestreamtag.go new file mode 100644 index 0000000000..9380fefbe5 --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/fake/fake_imagestreamtag.go @@ -0,0 +1,59 @@ +package fake + +import ( + image_v1 "github.com/openshift/api/image/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeImageStreamTags implements ImageStreamTagInterface +type FakeImageStreamTags struct { + Fake *FakeImageV1 + ns string +} + +var imagestreamtagsResource = schema.GroupVersionResource{Group: "image.openshift.io", Version: "v1", Resource: "imagestreamtags"} + +var imagestreamtagsKind = schema.GroupVersionKind{Group: "image.openshift.io", Version: "v1", Kind: "ImageStreamTag"} + +// Get takes name of the imageStreamTag, and returns the corresponding imageStreamTag object, and an error if there is any. +func (c *FakeImageStreamTags) Get(name string, options v1.GetOptions) (result *image_v1.ImageStreamTag, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(imagestreamtagsResource, c.ns, name), &image_v1.ImageStreamTag{}) + + if obj == nil { + return nil, err + } + return obj.(*image_v1.ImageStreamTag), err +} + +// Create takes the representation of a imageStreamTag and creates it. Returns the server's representation of the imageStreamTag, and an error, if there is any. +func (c *FakeImageStreamTags) Create(imageStreamTag *image_v1.ImageStreamTag) (result *image_v1.ImageStreamTag, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(imagestreamtagsResource, c.ns, imageStreamTag), &image_v1.ImageStreamTag{}) + + if obj == nil { + return nil, err + } + return obj.(*image_v1.ImageStreamTag), err +} + +// Update takes the representation of a imageStreamTag and updates it. Returns the server's representation of the imageStreamTag, and an error, if there is any. +func (c *FakeImageStreamTags) Update(imageStreamTag *image_v1.ImageStreamTag) (result *image_v1.ImageStreamTag, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(imagestreamtagsResource, c.ns, imageStreamTag), &image_v1.ImageStreamTag{}) + + if obj == nil { + return nil, err + } + return obj.(*image_v1.ImageStreamTag), err +} + +// Delete takes name of the imageStreamTag and deletes it. Returns an error if one occurs. +func (c *FakeImageStreamTags) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(imagestreamtagsResource, c.ns, name), &image_v1.ImageStreamTag{}) + + return err +} diff --git a/image/clientset/versioned/typed/image/v1/generated_expansion.go b/image/clientset/versioned/typed/image/v1/generated_expansion.go new file mode 100644 index 0000000000..3701e3f103 --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/generated_expansion.go @@ -0,0 +1,15 @@ +package v1 + +type ImageExpansion interface{} + +type ImageSignatureExpansion interface{} + +type ImageStreamExpansion interface{} + +type ImageStreamImageExpansion interface{} + +type ImageStreamImportExpansion interface{} + +type ImageStreamMappingExpansion interface{} + +type ImageStreamTagExpansion interface{} diff --git a/image/clientset/versioned/typed/image/v1/image.go b/image/clientset/versioned/typed/image/v1/image.go new file mode 100644 index 0000000000..5d52d609fe --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/image.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/image/v1" + scheme "github.com/openshift/client-go/image/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ImagesGetter has a method to return a ImageInterface. +// A group's client should implement this interface. +type ImagesGetter interface { + Images() ImageInterface +} + +// ImageInterface has methods to work with Image resources. +type ImageInterface interface { + Create(*v1.Image) (*v1.Image, error) + Update(*v1.Image) (*v1.Image, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.Image, error) + List(opts meta_v1.ListOptions) (*v1.ImageList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Image, err error) + ImageExpansion +} + +// images implements ImageInterface +type images struct { + client rest.Interface +} + +// newImages returns a Images +func newImages(c *ImageV1Client) *images { + return &images{ + client: c.RESTClient(), + } +} + +// Get takes name of the image, and returns the corresponding image object, and an error if there is any. +func (c *images) Get(name string, options meta_v1.GetOptions) (result *v1.Image, err error) { + result = &v1.Image{} + err = c.client.Get(). + Resource("images"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Images that match those selectors. +func (c *images) List(opts meta_v1.ListOptions) (result *v1.ImageList, err error) { + result = &v1.ImageList{} + err = c.client.Get(). + Resource("images"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested images. +func (c *images) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("images"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a image and creates it. Returns the server's representation of the image, and an error, if there is any. +func (c *images) Create(image *v1.Image) (result *v1.Image, err error) { + result = &v1.Image{} + err = c.client.Post(). + Resource("images"). + Body(image). + Do(). + Into(result) + return +} + +// Update takes the representation of a image and updates it. Returns the server's representation of the image, and an error, if there is any. +func (c *images) Update(image *v1.Image) (result *v1.Image, err error) { + result = &v1.Image{} + err = c.client.Put(). + Resource("images"). + Name(image.Name). + Body(image). + Do(). + Into(result) + return +} + +// Delete takes name of the image and deletes it. Returns an error if one occurs. +func (c *images) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("images"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *images) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("images"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched image. +func (c *images) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Image, err error) { + result = &v1.Image{} + err = c.client.Patch(pt). + Resource("images"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/image/clientset/versioned/typed/image/v1/image_client.go b/image/clientset/versioned/typed/image/v1/image_client.go new file mode 100644 index 0000000000..fe7c362cf0 --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/image_client.go @@ -0,0 +1,102 @@ +package v1 + +import ( + v1 "github.com/openshift/api/image/v1" + "github.com/openshift/client-go/image/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type ImageV1Interface interface { + RESTClient() rest.Interface + ImagesGetter + ImageSignaturesGetter + ImageStreamsGetter + ImageStreamImagesGetter + ImageStreamImportsGetter + ImageStreamMappingsGetter + ImageStreamTagsGetter +} + +// ImageV1Client is used to interact with features provided by the image.openshift.io group. +type ImageV1Client struct { + restClient rest.Interface +} + +func (c *ImageV1Client) Images() ImageInterface { + return newImages(c) +} + +func (c *ImageV1Client) ImageSignatures() ImageSignatureInterface { + return newImageSignatures(c) +} + +func (c *ImageV1Client) ImageStreams(namespace string) ImageStreamInterface { + return newImageStreams(c, namespace) +} + +func (c *ImageV1Client) ImageStreamImages(namespace string) ImageStreamImageInterface { + return newImageStreamImages(c, namespace) +} + +func (c *ImageV1Client) ImageStreamImports(namespace string) ImageStreamImportInterface { + return newImageStreamImports(c, namespace) +} + +func (c *ImageV1Client) ImageStreamMappings(namespace string) ImageStreamMappingInterface { + return newImageStreamMappings(c, namespace) +} + +func (c *ImageV1Client) ImageStreamTags(namespace string) ImageStreamTagInterface { + return newImageStreamTags(c, namespace) +} + +// NewForConfig creates a new ImageV1Client for the given config. +func NewForConfig(c *rest.Config) (*ImageV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &ImageV1Client{client}, nil +} + +// NewForConfigOrDie creates a new ImageV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *ImageV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ImageV1Client for the given RESTClient. +func New(c rest.Interface) *ImageV1Client { + return &ImageV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *ImageV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/image/clientset/versioned/typed/image/v1/imagesignature.go b/image/clientset/versioned/typed/image/v1/imagesignature.go new file mode 100644 index 0000000000..e299bf577e --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/imagesignature.go @@ -0,0 +1,53 @@ +package v1 + +import ( + v1 "github.com/openshift/api/image/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// ImageSignaturesGetter has a method to return a ImageSignatureInterface. +// A group's client should implement this interface. +type ImageSignaturesGetter interface { + ImageSignatures() ImageSignatureInterface +} + +// ImageSignatureInterface has methods to work with ImageSignature resources. +type ImageSignatureInterface interface { + Create(*v1.ImageSignature) (*v1.ImageSignature, error) + Delete(name string, options *meta_v1.DeleteOptions) error + ImageSignatureExpansion +} + +// imageSignatures implements ImageSignatureInterface +type imageSignatures struct { + client rest.Interface +} + +// newImageSignatures returns a ImageSignatures +func newImageSignatures(c *ImageV1Client) *imageSignatures { + return &imageSignatures{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a imageSignature and creates it. Returns the server's representation of the imageSignature, and an error, if there is any. +func (c *imageSignatures) Create(imageSignature *v1.ImageSignature) (result *v1.ImageSignature, err error) { + result = &v1.ImageSignature{} + err = c.client.Post(). + Resource("imagesignatures"). + Body(imageSignature). + Do(). + Into(result) + return +} + +// Delete takes name of the imageSignature and deletes it. Returns an error if one occurs. +func (c *imageSignatures) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("imagesignatures"). + Name(name). + Body(options). + Do(). + Error() +} diff --git a/image/clientset/versioned/typed/image/v1/imagestream.go b/image/clientset/versioned/typed/image/v1/imagestream.go new file mode 100644 index 0000000000..4e07da6fb0 --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/imagestream.go @@ -0,0 +1,173 @@ +package v1 + +import ( + v1 "github.com/openshift/api/image/v1" + scheme "github.com/openshift/client-go/image/clientset/versioned/scheme" + core_v1 "k8s.io/api/core/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ImageStreamsGetter has a method to return a ImageStreamInterface. +// A group's client should implement this interface. +type ImageStreamsGetter interface { + ImageStreams(namespace string) ImageStreamInterface +} + +// ImageStreamInterface has methods to work with ImageStream resources. +type ImageStreamInterface interface { + Create(*v1.ImageStream) (*v1.ImageStream, error) + Update(*v1.ImageStream) (*v1.ImageStream, error) + UpdateStatus(*v1.ImageStream) (*v1.ImageStream, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.ImageStream, error) + List(opts meta_v1.ListOptions) (*v1.ImageStreamList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ImageStream, err error) + Secrets(imageStreamName string, opts meta_v1.ListOptions) (*core_v1.SecretList, error) + + ImageStreamExpansion +} + +// imageStreams implements ImageStreamInterface +type imageStreams struct { + client rest.Interface + ns string +} + +// newImageStreams returns a ImageStreams +func newImageStreams(c *ImageV1Client, namespace string) *imageStreams { + return &imageStreams{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the imageStream, and returns the corresponding imageStream object, and an error if there is any. +func (c *imageStreams) Get(name string, options meta_v1.GetOptions) (result *v1.ImageStream, err error) { + result = &v1.ImageStream{} + err = c.client.Get(). + Namespace(c.ns). + Resource("imagestreams"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ImageStreams that match those selectors. +func (c *imageStreams) List(opts meta_v1.ListOptions) (result *v1.ImageStreamList, err error) { + result = &v1.ImageStreamList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("imagestreams"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested imageStreams. +func (c *imageStreams) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("imagestreams"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a imageStream and creates it. Returns the server's representation of the imageStream, and an error, if there is any. +func (c *imageStreams) Create(imageStream *v1.ImageStream) (result *v1.ImageStream, err error) { + result = &v1.ImageStream{} + err = c.client.Post(). + Namespace(c.ns). + Resource("imagestreams"). + Body(imageStream). + Do(). + Into(result) + return +} + +// Update takes the representation of a imageStream and updates it. Returns the server's representation of the imageStream, and an error, if there is any. +func (c *imageStreams) Update(imageStream *v1.ImageStream) (result *v1.ImageStream, err error) { + result = &v1.ImageStream{} + err = c.client.Put(). + Namespace(c.ns). + Resource("imagestreams"). + Name(imageStream.Name). + Body(imageStream). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *imageStreams) UpdateStatus(imageStream *v1.ImageStream) (result *v1.ImageStream, err error) { + result = &v1.ImageStream{} + err = c.client.Put(). + Namespace(c.ns). + Resource("imagestreams"). + Name(imageStream.Name). + SubResource("status"). + Body(imageStream). + Do(). + Into(result) + return +} + +// Delete takes name of the imageStream and deletes it. Returns an error if one occurs. +func (c *imageStreams) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("imagestreams"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *imageStreams) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("imagestreams"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched imageStream. +func (c *imageStreams) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ImageStream, err error) { + result = &v1.ImageStream{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("imagestreams"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} + +// Secrets takes v1.ImageStream name, label and field selectors, and returns the list of Secrets that match those selectors. +func (c *imageStreams) Secrets(imageStreamName string, opts meta_v1.ListOptions) (result *core_v1.SecretList, err error) { + result = &core_v1.SecretList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("imagestreams"). + Name(imageStreamName). + SubResource("secrets"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} diff --git a/image/clientset/versioned/typed/image/v1/imagestreamimage.go b/image/clientset/versioned/typed/image/v1/imagestreamimage.go new file mode 100644 index 0000000000..72875d8405 --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/imagestreamimage.go @@ -0,0 +1,47 @@ +package v1 + +import ( + image_v1 "github.com/openshift/api/image/v1" + scheme "github.com/openshift/client-go/image/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// ImageStreamImagesGetter has a method to return a ImageStreamImageInterface. +// A group's client should implement this interface. +type ImageStreamImagesGetter interface { + ImageStreamImages(namespace string) ImageStreamImageInterface +} + +// ImageStreamImageInterface has methods to work with ImageStreamImage resources. +type ImageStreamImageInterface interface { + Get(name string, options v1.GetOptions) (*image_v1.ImageStreamImage, error) + ImageStreamImageExpansion +} + +// imageStreamImages implements ImageStreamImageInterface +type imageStreamImages struct { + client rest.Interface + ns string +} + +// newImageStreamImages returns a ImageStreamImages +func newImageStreamImages(c *ImageV1Client, namespace string) *imageStreamImages { + return &imageStreamImages{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the imageStreamImage, and returns the corresponding imageStreamImage object, and an error if there is any. +func (c *imageStreamImages) Get(name string, options v1.GetOptions) (result *image_v1.ImageStreamImage, err error) { + result = &image_v1.ImageStreamImage{} + err = c.client.Get(). + Namespace(c.ns). + Resource("imagestreamimages"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} diff --git a/image/clientset/versioned/typed/image/v1/imagestreamimport.go b/image/clientset/versioned/typed/image/v1/imagestreamimport.go new file mode 100644 index 0000000000..c0fceb783a --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/imagestreamimport.go @@ -0,0 +1,44 @@ +package v1 + +import ( + v1 "github.com/openshift/api/image/v1" + rest "k8s.io/client-go/rest" +) + +// ImageStreamImportsGetter has a method to return a ImageStreamImportInterface. +// A group's client should implement this interface. +type ImageStreamImportsGetter interface { + ImageStreamImports(namespace string) ImageStreamImportInterface +} + +// ImageStreamImportInterface has methods to work with ImageStreamImport resources. +type ImageStreamImportInterface interface { + Create(*v1.ImageStreamImport) (*v1.ImageStreamImport, error) + ImageStreamImportExpansion +} + +// imageStreamImports implements ImageStreamImportInterface +type imageStreamImports struct { + client rest.Interface + ns string +} + +// newImageStreamImports returns a ImageStreamImports +func newImageStreamImports(c *ImageV1Client, namespace string) *imageStreamImports { + return &imageStreamImports{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a imageStreamImport and creates it. Returns the server's representation of the imageStreamImport, and an error, if there is any. +func (c *imageStreamImports) Create(imageStreamImport *v1.ImageStreamImport) (result *v1.ImageStreamImport, err error) { + result = &v1.ImageStreamImport{} + err = c.client.Post(). + Namespace(c.ns). + Resource("imagestreamimports"). + Body(imageStreamImport). + Do(). + Into(result) + return +} diff --git a/image/clientset/versioned/typed/image/v1/imagestreammapping.go b/image/clientset/versioned/typed/image/v1/imagestreammapping.go new file mode 100644 index 0000000000..cd8ff04a0c --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/imagestreammapping.go @@ -0,0 +1,46 @@ +package v1 + +import ( + v1 "github.com/openshift/api/image/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// ImageStreamMappingsGetter has a method to return a ImageStreamMappingInterface. +// A group's client should implement this interface. +type ImageStreamMappingsGetter interface { + ImageStreamMappings(namespace string) ImageStreamMappingInterface +} + +// ImageStreamMappingInterface has methods to work with ImageStreamMapping resources. +type ImageStreamMappingInterface interface { + Create(*v1.ImageStreamMapping) (*meta_v1.Status, error) + + ImageStreamMappingExpansion +} + +// imageStreamMappings implements ImageStreamMappingInterface +type imageStreamMappings struct { + client rest.Interface + ns string +} + +// newImageStreamMappings returns a ImageStreamMappings +func newImageStreamMappings(c *ImageV1Client, namespace string) *imageStreamMappings { + return &imageStreamMappings{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a imageStreamMapping and creates it. Returns the server's representation of the status, and an error, if there is any. +func (c *imageStreamMappings) Create(imageStreamMapping *v1.ImageStreamMapping) (result *meta_v1.Status, err error) { + result = &meta_v1.Status{} + err = c.client.Post(). + Namespace(c.ns). + Resource("imagestreammappings"). + Body(imageStreamMapping). + Do(). + Into(result) + return +} diff --git a/image/clientset/versioned/typed/image/v1/imagestreamtag.go b/image/clientset/versioned/typed/image/v1/imagestreamtag.go new file mode 100644 index 0000000000..9b5eb328a2 --- /dev/null +++ b/image/clientset/versioned/typed/image/v1/imagestreamtag.go @@ -0,0 +1,86 @@ +package v1 + +import ( + v1 "github.com/openshift/api/image/v1" + scheme "github.com/openshift/client-go/image/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// ImageStreamTagsGetter has a method to return a ImageStreamTagInterface. +// A group's client should implement this interface. +type ImageStreamTagsGetter interface { + ImageStreamTags(namespace string) ImageStreamTagInterface +} + +// ImageStreamTagInterface has methods to work with ImageStreamTag resources. +type ImageStreamTagInterface interface { + Create(*v1.ImageStreamTag) (*v1.ImageStreamTag, error) + Update(*v1.ImageStreamTag) (*v1.ImageStreamTag, error) + Delete(name string, options *meta_v1.DeleteOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.ImageStreamTag, error) + ImageStreamTagExpansion +} + +// imageStreamTags implements ImageStreamTagInterface +type imageStreamTags struct { + client rest.Interface + ns string +} + +// newImageStreamTags returns a ImageStreamTags +func newImageStreamTags(c *ImageV1Client, namespace string) *imageStreamTags { + return &imageStreamTags{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the imageStreamTag, and returns the corresponding imageStreamTag object, and an error if there is any. +func (c *imageStreamTags) Get(name string, options meta_v1.GetOptions) (result *v1.ImageStreamTag, err error) { + result = &v1.ImageStreamTag{} + err = c.client.Get(). + Namespace(c.ns). + Resource("imagestreamtags"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Create takes the representation of a imageStreamTag and creates it. Returns the server's representation of the imageStreamTag, and an error, if there is any. +func (c *imageStreamTags) Create(imageStreamTag *v1.ImageStreamTag) (result *v1.ImageStreamTag, err error) { + result = &v1.ImageStreamTag{} + err = c.client.Post(). + Namespace(c.ns). + Resource("imagestreamtags"). + Body(imageStreamTag). + Do(). + Into(result) + return +} + +// Update takes the representation of a imageStreamTag and updates it. Returns the server's representation of the imageStreamTag, and an error, if there is any. +func (c *imageStreamTags) Update(imageStreamTag *v1.ImageStreamTag) (result *v1.ImageStreamTag, err error) { + result = &v1.ImageStreamTag{} + err = c.client.Put(). + Namespace(c.ns). + Resource("imagestreamtags"). + Name(imageStreamTag.Name). + Body(imageStreamTag). + Do(). + Into(result) + return +} + +// Delete takes name of the imageStreamTag and deletes it. Returns an error if one occurs. +func (c *imageStreamTags) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("imagestreamtags"). + Name(name). + Body(options). + Do(). + Error() +} diff --git a/image/informers/externalversions/factory.go b/image/informers/externalversions/factory.go new file mode 100644 index 0000000000..eb65d57f0f --- /dev/null +++ b/image/informers/externalversions/factory.go @@ -0,0 +1,102 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + versioned "github.com/openshift/client-go/image/clientset/versioned" + image "github.com/openshift/client-go/image/informers/externalversions/image" + internalinterfaces "github.com/openshift/client-go/image/informers/externalversions/internalinterfaces" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + reflect "reflect" + sync "sync" + time "time" +) + +type sharedInformerFactory struct { + client versioned.Interface + lock sync.Mutex + defaultResync time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return &sharedInformerFactory{ + client: client, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + } +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + informer = newFunc(f.client, f.defaultResync) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Image() image.Interface +} + +func (f *sharedInformerFactory) Image() image.Interface { + return image.New(f) +} diff --git a/image/informers/externalversions/generic.go b/image/informers/externalversions/generic.go new file mode 100644 index 0000000000..1d12a519ef --- /dev/null +++ b/image/informers/externalversions/generic.go @@ -0,0 +1,47 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + "fmt" + v1 "github.com/openshift/api/image/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=Image, Version=V1 + case v1.SchemeGroupVersion.WithResource("images"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Image().V1().Images().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("imagestreams"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Image().V1().ImageStreams().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/image/informers/externalversions/image/interface.go b/image/informers/externalversions/image/interface.go new file mode 100644 index 0000000000..e850714867 --- /dev/null +++ b/image/informers/externalversions/image/interface.go @@ -0,0 +1,28 @@ +// This file was automatically generated by informer-gen + +package image + +import ( + v1 "github.com/openshift/client-go/image/informers/externalversions/image/v1" + internalinterfaces "github.com/openshift/client-go/image/informers/externalversions/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &group{f} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.SharedInformerFactory) +} diff --git a/image/informers/externalversions/image/v1/image.go b/image/informers/externalversions/image/v1/image.go new file mode 100644 index 0000000000..429a429902 --- /dev/null +++ b/image/informers/externalversions/image/v1/image.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + image_v1 "github.com/openshift/api/image/v1" + versioned "github.com/openshift/client-go/image/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/image/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/image/listers/image/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// ImageInformer provides access to a shared informer and lister for +// Images. +type ImageInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ImageLister +} + +type imageInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewImageInformer constructs a new informer for Image type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewImageInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.ImageV1().Images().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.ImageV1().Images().Watch(options) + }, + }, + &image_v1.Image{}, + resyncPeriod, + indexers, + ) +} + +func defaultImageInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewImageInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *imageInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&image_v1.Image{}, defaultImageInformer) +} + +func (f *imageInformer) Lister() v1.ImageLister { + return v1.NewImageLister(f.Informer().GetIndexer()) +} diff --git a/image/informers/externalversions/image/v1/imagestream.go b/image/informers/externalversions/image/v1/imagestream.go new file mode 100644 index 0000000000..b0bf6649d3 --- /dev/null +++ b/image/informers/externalversions/image/v1/imagestream.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + image_v1 "github.com/openshift/api/image/v1" + versioned "github.com/openshift/client-go/image/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/image/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/image/listers/image/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// ImageStreamInformer provides access to a shared informer and lister for +// ImageStreams. +type ImageStreamInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ImageStreamLister +} + +type imageStreamInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewImageStreamInformer constructs a new informer for ImageStream type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewImageStreamInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.ImageV1().ImageStreams(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.ImageV1().ImageStreams(namespace).Watch(options) + }, + }, + &image_v1.ImageStream{}, + resyncPeriod, + indexers, + ) +} + +func defaultImageStreamInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewImageStreamInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *imageStreamInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&image_v1.ImageStream{}, defaultImageStreamInformer) +} + +func (f *imageStreamInformer) Lister() v1.ImageStreamLister { + return v1.NewImageStreamLister(f.Informer().GetIndexer()) +} diff --git a/image/informers/externalversions/image/v1/interface.go b/image/informers/externalversions/image/v1/interface.go new file mode 100644 index 0000000000..9ced558432 --- /dev/null +++ b/image/informers/externalversions/image/v1/interface.go @@ -0,0 +1,34 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + internalinterfaces "github.com/openshift/client-go/image/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Images returns a ImageInformer. + Images() ImageInformer + // ImageStreams returns a ImageStreamInformer. + ImageStreams() ImageStreamInformer +} + +type version struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &version{f} +} + +// Images returns a ImageInformer. +func (v *version) Images() ImageInformer { + return &imageInformer{factory: v.SharedInformerFactory} +} + +// ImageStreams returns a ImageStreamInformer. +func (v *version) ImageStreams() ImageStreamInformer { + return &imageStreamInformer{factory: v.SharedInformerFactory} +} diff --git a/image/informers/externalversions/internalinterfaces/factory_interfaces.go b/image/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..44c46d5ae3 --- /dev/null +++ b/image/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,18 @@ +// This file was automatically generated by informer-gen + +package internalinterfaces + +import ( + versioned "github.com/openshift/client-go/image/clientset/versioned" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} diff --git a/image/listers/image/v1/expansion_generated.go b/image/listers/image/v1/expansion_generated.go new file mode 100644 index 0000000000..4ad4756813 --- /dev/null +++ b/image/listers/image/v1/expansion_generated.go @@ -0,0 +1,15 @@ +// This file was automatically generated by lister-gen + +package v1 + +// ImageListerExpansion allows custom methods to be added to +// ImageLister. +type ImageListerExpansion interface{} + +// ImageStreamListerExpansion allows custom methods to be added to +// ImageStreamLister. +type ImageStreamListerExpansion interface{} + +// ImageStreamNamespaceListerExpansion allows custom methods to be added to +// ImageStreamNamespaceLister. +type ImageStreamNamespaceListerExpansion interface{} diff --git a/image/listers/image/v1/image.go b/image/listers/image/v1/image.go new file mode 100644 index 0000000000..32ba5298ec --- /dev/null +++ b/image/listers/image/v1/image.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/image/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ImageLister helps list Images. +type ImageLister interface { + // List lists all Images in the indexer. + List(selector labels.Selector) (ret []*v1.Image, err error) + // Get retrieves the Image from the index for a given name. + Get(name string) (*v1.Image, error) + ImageListerExpansion +} + +// imageLister implements the ImageLister interface. +type imageLister struct { + indexer cache.Indexer +} + +// NewImageLister returns a new ImageLister. +func NewImageLister(indexer cache.Indexer) ImageLister { + return &imageLister{indexer: indexer} +} + +// List lists all Images in the indexer. +func (s *imageLister) List(selector labels.Selector) (ret []*v1.Image, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Image)) + }) + return ret, err +} + +// Get retrieves the Image from the index for a given name. +func (s *imageLister) Get(name string) (*v1.Image, error) { + key := &v1.Image{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("image"), name) + } + return obj.(*v1.Image), nil +} diff --git a/image/listers/image/v1/imagestream.go b/image/listers/image/v1/imagestream.go new file mode 100644 index 0000000000..9b88bb52bf --- /dev/null +++ b/image/listers/image/v1/imagestream.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/image/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ImageStreamLister helps list ImageStreams. +type ImageStreamLister interface { + // List lists all ImageStreams in the indexer. + List(selector labels.Selector) (ret []*v1.ImageStream, err error) + // ImageStreams returns an object that can list and get ImageStreams. + ImageStreams(namespace string) ImageStreamNamespaceLister + ImageStreamListerExpansion +} + +// imageStreamLister implements the ImageStreamLister interface. +type imageStreamLister struct { + indexer cache.Indexer +} + +// NewImageStreamLister returns a new ImageStreamLister. +func NewImageStreamLister(indexer cache.Indexer) ImageStreamLister { + return &imageStreamLister{indexer: indexer} +} + +// List lists all ImageStreams in the indexer. +func (s *imageStreamLister) List(selector labels.Selector) (ret []*v1.ImageStream, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ImageStream)) + }) + return ret, err +} + +// ImageStreams returns an object that can list and get ImageStreams. +func (s *imageStreamLister) ImageStreams(namespace string) ImageStreamNamespaceLister { + return imageStreamNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ImageStreamNamespaceLister helps list and get ImageStreams. +type ImageStreamNamespaceLister interface { + // List lists all ImageStreams in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.ImageStream, err error) + // Get retrieves the ImageStream from the indexer for a given namespace and name. + Get(name string) (*v1.ImageStream, error) + ImageStreamNamespaceListerExpansion +} + +// imageStreamNamespaceLister implements the ImageStreamNamespaceLister +// interface. +type imageStreamNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ImageStreams in the indexer for a given namespace. +func (s imageStreamNamespaceLister) List(selector labels.Selector) (ret []*v1.ImageStream, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ImageStream)) + }) + return ret, err +} + +// Get retrieves the ImageStream from the indexer for a given namespace and name. +func (s imageStreamNamespaceLister) Get(name string) (*v1.ImageStream, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("imagestream"), name) + } + return obj.(*v1.ImageStream), nil +} diff --git a/network/clientset/versioned/clientset.go b/network/clientset/versioned/clientset.go new file mode 100644 index 0000000000..660930acf6 --- /dev/null +++ b/network/clientset/versioned/clientset.go @@ -0,0 +1,82 @@ +package versioned + +import ( + glog "github.com/golang/glog" + networkv1 "github.com/openshift/client-go/network/clientset/versioned/typed/network/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + NetworkV1() networkv1.NetworkV1Interface + // Deprecated: please explicitly pick a version if possible. + Network() networkv1.NetworkV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + networkV1 *networkv1.NetworkV1Client +} + +// NetworkV1 retrieves the NetworkV1Client +func (c *Clientset) NetworkV1() networkv1.NetworkV1Interface { + return c.networkV1 +} + +// Deprecated: Network retrieves the default version of NetworkClient. +// Please explicitly pick a version. +func (c *Clientset) Network() networkv1.NetworkV1Interface { + return c.networkV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.networkV1, err = networkv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.networkV1 = networkv1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.networkV1 = networkv1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/network/clientset/versioned/doc.go b/network/clientset/versioned/doc.go new file mode 100644 index 0000000000..72f92921e6 --- /dev/null +++ b/network/clientset/versioned/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated clientset. +package versioned diff --git a/network/clientset/versioned/fake/clientset_generated.go b/network/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..045b29d9ef --- /dev/null +++ b/network/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,55 @@ +package fake + +import ( + clientset "github.com/openshift/client-go/network/clientset/versioned" + networkv1 "github.com/openshift/client-go/network/clientset/versioned/typed/network/v1" + fakenetworkv1 "github.com/openshift/client-go/network/clientset/versioned/typed/network/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := testing.Fake{} + fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) + fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// NetworkV1 retrieves the NetworkV1Client +func (c *Clientset) NetworkV1() networkv1.NetworkV1Interface { + return &fakenetworkv1.FakeNetworkV1{Fake: &c.Fake} +} + +// Network retrieves the NetworkV1Client +func (c *Clientset) Network() networkv1.NetworkV1Interface { + return &fakenetworkv1.FakeNetworkV1{Fake: &c.Fake} +} diff --git a/network/clientset/versioned/fake/doc.go b/network/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..760aaa8253 --- /dev/null +++ b/network/clientset/versioned/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated fake clientset. +package fake diff --git a/network/clientset/versioned/fake/register.go b/network/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..d7df9017e2 --- /dev/null +++ b/network/clientset/versioned/fake/register.go @@ -0,0 +1,37 @@ +package fake + +import ( + networkv1 "github.com/openshift/api/network/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + networkv1.AddToScheme(scheme) + +} diff --git a/network/clientset/versioned/scheme/doc.go b/network/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..d1c53d03b2 --- /dev/null +++ b/network/clientset/versioned/scheme/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/network/clientset/versioned/scheme/register.go b/network/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..f29f3d1fca --- /dev/null +++ b/network/clientset/versioned/scheme/register.go @@ -0,0 +1,37 @@ +package scheme + +import ( + networkv1 "github.com/openshift/api/network/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + networkv1.AddToScheme(scheme) + +} diff --git a/network/clientset/versioned/typed/network/v1/clusternetwork.go b/network/clientset/versioned/typed/network/v1/clusternetwork.go new file mode 100644 index 0000000000..cc44fcdf6d --- /dev/null +++ b/network/clientset/versioned/typed/network/v1/clusternetwork.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/network/v1" + scheme "github.com/openshift/client-go/network/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ClusterNetworksGetter has a method to return a ClusterNetworkInterface. +// A group's client should implement this interface. +type ClusterNetworksGetter interface { + ClusterNetworks() ClusterNetworkInterface +} + +// ClusterNetworkInterface has methods to work with ClusterNetwork resources. +type ClusterNetworkInterface interface { + Create(*v1.ClusterNetwork) (*v1.ClusterNetwork, error) + Update(*v1.ClusterNetwork) (*v1.ClusterNetwork, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.ClusterNetwork, error) + List(opts meta_v1.ListOptions) (*v1.ClusterNetworkList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterNetwork, err error) + ClusterNetworkExpansion +} + +// clusterNetworks implements ClusterNetworkInterface +type clusterNetworks struct { + client rest.Interface +} + +// newClusterNetworks returns a ClusterNetworks +func newClusterNetworks(c *NetworkV1Client) *clusterNetworks { + return &clusterNetworks{ + client: c.RESTClient(), + } +} + +// Get takes name of the clusterNetwork, and returns the corresponding clusterNetwork object, and an error if there is any. +func (c *clusterNetworks) Get(name string, options meta_v1.GetOptions) (result *v1.ClusterNetwork, err error) { + result = &v1.ClusterNetwork{} + err = c.client.Get(). + Resource("clusternetworks"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterNetworks that match those selectors. +func (c *clusterNetworks) List(opts meta_v1.ListOptions) (result *v1.ClusterNetworkList, err error) { + result = &v1.ClusterNetworkList{} + err = c.client.Get(). + Resource("clusternetworks"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterNetworks. +func (c *clusterNetworks) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("clusternetworks"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a clusterNetwork and creates it. Returns the server's representation of the clusterNetwork, and an error, if there is any. +func (c *clusterNetworks) Create(clusterNetwork *v1.ClusterNetwork) (result *v1.ClusterNetwork, err error) { + result = &v1.ClusterNetwork{} + err = c.client.Post(). + Resource("clusternetworks"). + Body(clusterNetwork). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterNetwork and updates it. Returns the server's representation of the clusterNetwork, and an error, if there is any. +func (c *clusterNetworks) Update(clusterNetwork *v1.ClusterNetwork) (result *v1.ClusterNetwork, err error) { + result = &v1.ClusterNetwork{} + err = c.client.Put(). + Resource("clusternetworks"). + Name(clusterNetwork.Name). + Body(clusterNetwork). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterNetwork and deletes it. Returns an error if one occurs. +func (c *clusterNetworks) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clusternetworks"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterNetworks) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("clusternetworks"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched clusterNetwork. +func (c *clusterNetworks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterNetwork, err error) { + result = &v1.ClusterNetwork{} + err = c.client.Patch(pt). + Resource("clusternetworks"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/network/clientset/versioned/typed/network/v1/doc.go b/network/clientset/versioned/typed/network/v1/doc.go new file mode 100644 index 0000000000..0e93c2c5e7 --- /dev/null +++ b/network/clientset/versioned/typed/network/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated typed clients. +package v1 diff --git a/network/clientset/versioned/typed/network/v1/egressnetworkpolicy.go b/network/clientset/versioned/typed/network/v1/egressnetworkpolicy.go new file mode 100644 index 0000000000..ebf74ef5c2 --- /dev/null +++ b/network/clientset/versioned/typed/network/v1/egressnetworkpolicy.go @@ -0,0 +1,139 @@ +package v1 + +import ( + v1 "github.com/openshift/api/network/v1" + scheme "github.com/openshift/client-go/network/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// EgressNetworkPoliciesGetter has a method to return a EgressNetworkPolicyInterface. +// A group's client should implement this interface. +type EgressNetworkPoliciesGetter interface { + EgressNetworkPolicies(namespace string) EgressNetworkPolicyInterface +} + +// EgressNetworkPolicyInterface has methods to work with EgressNetworkPolicy resources. +type EgressNetworkPolicyInterface interface { + Create(*v1.EgressNetworkPolicy) (*v1.EgressNetworkPolicy, error) + Update(*v1.EgressNetworkPolicy) (*v1.EgressNetworkPolicy, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.EgressNetworkPolicy, error) + List(opts meta_v1.ListOptions) (*v1.EgressNetworkPolicyList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.EgressNetworkPolicy, err error) + EgressNetworkPolicyExpansion +} + +// egressNetworkPolicies implements EgressNetworkPolicyInterface +type egressNetworkPolicies struct { + client rest.Interface + ns string +} + +// newEgressNetworkPolicies returns a EgressNetworkPolicies +func newEgressNetworkPolicies(c *NetworkV1Client, namespace string) *egressNetworkPolicies { + return &egressNetworkPolicies{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the egressNetworkPolicy, and returns the corresponding egressNetworkPolicy object, and an error if there is any. +func (c *egressNetworkPolicies) Get(name string, options meta_v1.GetOptions) (result *v1.EgressNetworkPolicy, err error) { + result = &v1.EgressNetworkPolicy{} + err = c.client.Get(). + Namespace(c.ns). + Resource("egressnetworkpolicies"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of EgressNetworkPolicies that match those selectors. +func (c *egressNetworkPolicies) List(opts meta_v1.ListOptions) (result *v1.EgressNetworkPolicyList, err error) { + result = &v1.EgressNetworkPolicyList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("egressnetworkpolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested egressNetworkPolicies. +func (c *egressNetworkPolicies) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("egressnetworkpolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a egressNetworkPolicy and creates it. Returns the server's representation of the egressNetworkPolicy, and an error, if there is any. +func (c *egressNetworkPolicies) Create(egressNetworkPolicy *v1.EgressNetworkPolicy) (result *v1.EgressNetworkPolicy, err error) { + result = &v1.EgressNetworkPolicy{} + err = c.client.Post(). + Namespace(c.ns). + Resource("egressnetworkpolicies"). + Body(egressNetworkPolicy). + Do(). + Into(result) + return +} + +// Update takes the representation of a egressNetworkPolicy and updates it. Returns the server's representation of the egressNetworkPolicy, and an error, if there is any. +func (c *egressNetworkPolicies) Update(egressNetworkPolicy *v1.EgressNetworkPolicy) (result *v1.EgressNetworkPolicy, err error) { + result = &v1.EgressNetworkPolicy{} + err = c.client.Put(). + Namespace(c.ns). + Resource("egressnetworkpolicies"). + Name(egressNetworkPolicy.Name). + Body(egressNetworkPolicy). + Do(). + Into(result) + return +} + +// Delete takes name of the egressNetworkPolicy and deletes it. Returns an error if one occurs. +func (c *egressNetworkPolicies) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("egressnetworkpolicies"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *egressNetworkPolicies) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("egressnetworkpolicies"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched egressNetworkPolicy. +func (c *egressNetworkPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.EgressNetworkPolicy, err error) { + result = &v1.EgressNetworkPolicy{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("egressnetworkpolicies"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/network/clientset/versioned/typed/network/v1/fake/doc.go b/network/clientset/versioned/typed/network/v1/fake/doc.go new file mode 100644 index 0000000000..e3bbd12a2b --- /dev/null +++ b/network/clientset/versioned/typed/network/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// Package fake has the automatically generated clients. +package fake diff --git a/network/clientset/versioned/typed/network/v1/fake/fake_clusternetwork.go b/network/clientset/versioned/typed/network/v1/fake/fake_clusternetwork.go new file mode 100644 index 0000000000..4b6281c640 --- /dev/null +++ b/network/clientset/versioned/typed/network/v1/fake/fake_clusternetwork.go @@ -0,0 +1,102 @@ +package fake + +import ( + network_v1 "github.com/openshift/api/network/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeClusterNetworks implements ClusterNetworkInterface +type FakeClusterNetworks struct { + Fake *FakeNetworkV1 +} + +var clusternetworksResource = schema.GroupVersionResource{Group: "network.openshift.io", Version: "v1", Resource: "clusternetworks"} + +var clusternetworksKind = schema.GroupVersionKind{Group: "network.openshift.io", Version: "v1", Kind: "ClusterNetwork"} + +// Get takes name of the clusterNetwork, and returns the corresponding clusterNetwork object, and an error if there is any. +func (c *FakeClusterNetworks) Get(name string, options v1.GetOptions) (result *network_v1.ClusterNetwork, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clusternetworksResource, name), &network_v1.ClusterNetwork{}) + if obj == nil { + return nil, err + } + return obj.(*network_v1.ClusterNetwork), err +} + +// List takes label and field selectors, and returns the list of ClusterNetworks that match those selectors. +func (c *FakeClusterNetworks) List(opts v1.ListOptions) (result *network_v1.ClusterNetworkList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clusternetworksResource, clusternetworksKind, opts), &network_v1.ClusterNetworkList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &network_v1.ClusterNetworkList{} + for _, item := range obj.(*network_v1.ClusterNetworkList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterNetworks. +func (c *FakeClusterNetworks) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clusternetworksResource, opts)) +} + +// Create takes the representation of a clusterNetwork and creates it. Returns the server's representation of the clusterNetwork, and an error, if there is any. +func (c *FakeClusterNetworks) Create(clusterNetwork *network_v1.ClusterNetwork) (result *network_v1.ClusterNetwork, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clusternetworksResource, clusterNetwork), &network_v1.ClusterNetwork{}) + if obj == nil { + return nil, err + } + return obj.(*network_v1.ClusterNetwork), err +} + +// Update takes the representation of a clusterNetwork and updates it. Returns the server's representation of the clusterNetwork, and an error, if there is any. +func (c *FakeClusterNetworks) Update(clusterNetwork *network_v1.ClusterNetwork) (result *network_v1.ClusterNetwork, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clusternetworksResource, clusterNetwork), &network_v1.ClusterNetwork{}) + if obj == nil { + return nil, err + } + return obj.(*network_v1.ClusterNetwork), err +} + +// Delete takes name of the clusterNetwork and deletes it. Returns an error if one occurs. +func (c *FakeClusterNetworks) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(clusternetworksResource, name), &network_v1.ClusterNetwork{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterNetworks) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clusternetworksResource, listOptions) + + _, err := c.Fake.Invokes(action, &network_v1.ClusterNetworkList{}) + return err +} + +// Patch applies the patch and returns the patched clusterNetwork. +func (c *FakeClusterNetworks) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *network_v1.ClusterNetwork, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusternetworksResource, name, data, subresources...), &network_v1.ClusterNetwork{}) + if obj == nil { + return nil, err + } + return obj.(*network_v1.ClusterNetwork), err +} diff --git a/network/clientset/versioned/typed/network/v1/fake/fake_egressnetworkpolicy.go b/network/clientset/versioned/typed/network/v1/fake/fake_egressnetworkpolicy.go new file mode 100644 index 0000000000..9b8a23b251 --- /dev/null +++ b/network/clientset/versioned/typed/network/v1/fake/fake_egressnetworkpolicy.go @@ -0,0 +1,110 @@ +package fake + +import ( + network_v1 "github.com/openshift/api/network/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeEgressNetworkPolicies implements EgressNetworkPolicyInterface +type FakeEgressNetworkPolicies struct { + Fake *FakeNetworkV1 + ns string +} + +var egressnetworkpoliciesResource = schema.GroupVersionResource{Group: "network.openshift.io", Version: "v1", Resource: "egressnetworkpolicies"} + +var egressnetworkpoliciesKind = schema.GroupVersionKind{Group: "network.openshift.io", Version: "v1", Kind: "EgressNetworkPolicy"} + +// Get takes name of the egressNetworkPolicy, and returns the corresponding egressNetworkPolicy object, and an error if there is any. +func (c *FakeEgressNetworkPolicies) Get(name string, options v1.GetOptions) (result *network_v1.EgressNetworkPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(egressnetworkpoliciesResource, c.ns, name), &network_v1.EgressNetworkPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*network_v1.EgressNetworkPolicy), err +} + +// List takes label and field selectors, and returns the list of EgressNetworkPolicies that match those selectors. +func (c *FakeEgressNetworkPolicies) List(opts v1.ListOptions) (result *network_v1.EgressNetworkPolicyList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(egressnetworkpoliciesResource, egressnetworkpoliciesKind, c.ns, opts), &network_v1.EgressNetworkPolicyList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &network_v1.EgressNetworkPolicyList{} + for _, item := range obj.(*network_v1.EgressNetworkPolicyList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested egressNetworkPolicies. +func (c *FakeEgressNetworkPolicies) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(egressnetworkpoliciesResource, c.ns, opts)) + +} + +// Create takes the representation of a egressNetworkPolicy and creates it. Returns the server's representation of the egressNetworkPolicy, and an error, if there is any. +func (c *FakeEgressNetworkPolicies) Create(egressNetworkPolicy *network_v1.EgressNetworkPolicy) (result *network_v1.EgressNetworkPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(egressnetworkpoliciesResource, c.ns, egressNetworkPolicy), &network_v1.EgressNetworkPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*network_v1.EgressNetworkPolicy), err +} + +// Update takes the representation of a egressNetworkPolicy and updates it. Returns the server's representation of the egressNetworkPolicy, and an error, if there is any. +func (c *FakeEgressNetworkPolicies) Update(egressNetworkPolicy *network_v1.EgressNetworkPolicy) (result *network_v1.EgressNetworkPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(egressnetworkpoliciesResource, c.ns, egressNetworkPolicy), &network_v1.EgressNetworkPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*network_v1.EgressNetworkPolicy), err +} + +// Delete takes name of the egressNetworkPolicy and deletes it. Returns an error if one occurs. +func (c *FakeEgressNetworkPolicies) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(egressnetworkpoliciesResource, c.ns, name), &network_v1.EgressNetworkPolicy{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEgressNetworkPolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(egressnetworkpoliciesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &network_v1.EgressNetworkPolicyList{}) + return err +} + +// Patch applies the patch and returns the patched egressNetworkPolicy. +func (c *FakeEgressNetworkPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *network_v1.EgressNetworkPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(egressnetworkpoliciesResource, c.ns, name, data, subresources...), &network_v1.EgressNetworkPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*network_v1.EgressNetworkPolicy), err +} diff --git a/network/clientset/versioned/typed/network/v1/fake/fake_hostsubnet.go b/network/clientset/versioned/typed/network/v1/fake/fake_hostsubnet.go new file mode 100644 index 0000000000..60dcebad93 --- /dev/null +++ b/network/clientset/versioned/typed/network/v1/fake/fake_hostsubnet.go @@ -0,0 +1,102 @@ +package fake + +import ( + network_v1 "github.com/openshift/api/network/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeHostSubnets implements HostSubnetInterface +type FakeHostSubnets struct { + Fake *FakeNetworkV1 +} + +var hostsubnetsResource = schema.GroupVersionResource{Group: "network.openshift.io", Version: "v1", Resource: "hostsubnets"} + +var hostsubnetsKind = schema.GroupVersionKind{Group: "network.openshift.io", Version: "v1", Kind: "HostSubnet"} + +// Get takes name of the hostSubnet, and returns the corresponding hostSubnet object, and an error if there is any. +func (c *FakeHostSubnets) Get(name string, options v1.GetOptions) (result *network_v1.HostSubnet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(hostsubnetsResource, name), &network_v1.HostSubnet{}) + if obj == nil { + return nil, err + } + return obj.(*network_v1.HostSubnet), err +} + +// List takes label and field selectors, and returns the list of HostSubnets that match those selectors. +func (c *FakeHostSubnets) List(opts v1.ListOptions) (result *network_v1.HostSubnetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(hostsubnetsResource, hostsubnetsKind, opts), &network_v1.HostSubnetList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &network_v1.HostSubnetList{} + for _, item := range obj.(*network_v1.HostSubnetList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested hostSubnets. +func (c *FakeHostSubnets) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(hostsubnetsResource, opts)) +} + +// Create takes the representation of a hostSubnet and creates it. Returns the server's representation of the hostSubnet, and an error, if there is any. +func (c *FakeHostSubnets) Create(hostSubnet *network_v1.HostSubnet) (result *network_v1.HostSubnet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(hostsubnetsResource, hostSubnet), &network_v1.HostSubnet{}) + if obj == nil { + return nil, err + } + return obj.(*network_v1.HostSubnet), err +} + +// Update takes the representation of a hostSubnet and updates it. Returns the server's representation of the hostSubnet, and an error, if there is any. +func (c *FakeHostSubnets) Update(hostSubnet *network_v1.HostSubnet) (result *network_v1.HostSubnet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(hostsubnetsResource, hostSubnet), &network_v1.HostSubnet{}) + if obj == nil { + return nil, err + } + return obj.(*network_v1.HostSubnet), err +} + +// Delete takes name of the hostSubnet and deletes it. Returns an error if one occurs. +func (c *FakeHostSubnets) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(hostsubnetsResource, name), &network_v1.HostSubnet{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeHostSubnets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(hostsubnetsResource, listOptions) + + _, err := c.Fake.Invokes(action, &network_v1.HostSubnetList{}) + return err +} + +// Patch applies the patch and returns the patched hostSubnet. +func (c *FakeHostSubnets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *network_v1.HostSubnet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(hostsubnetsResource, name, data, subresources...), &network_v1.HostSubnet{}) + if obj == nil { + return nil, err + } + return obj.(*network_v1.HostSubnet), err +} diff --git a/network/clientset/versioned/typed/network/v1/fake/fake_netnamespace.go b/network/clientset/versioned/typed/network/v1/fake/fake_netnamespace.go new file mode 100644 index 0000000000..717b1eb8d7 --- /dev/null +++ b/network/clientset/versioned/typed/network/v1/fake/fake_netnamespace.go @@ -0,0 +1,102 @@ +package fake + +import ( + network_v1 "github.com/openshift/api/network/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeNetNamespaces implements NetNamespaceInterface +type FakeNetNamespaces struct { + Fake *FakeNetworkV1 +} + +var netnamespacesResource = schema.GroupVersionResource{Group: "network.openshift.io", Version: "v1", Resource: "netnamespaces"} + +var netnamespacesKind = schema.GroupVersionKind{Group: "network.openshift.io", Version: "v1", Kind: "NetNamespace"} + +// Get takes name of the netNamespace, and returns the corresponding netNamespace object, and an error if there is any. +func (c *FakeNetNamespaces) Get(name string, options v1.GetOptions) (result *network_v1.NetNamespace, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(netnamespacesResource, name), &network_v1.NetNamespace{}) + if obj == nil { + return nil, err + } + return obj.(*network_v1.NetNamespace), err +} + +// List takes label and field selectors, and returns the list of NetNamespaces that match those selectors. +func (c *FakeNetNamespaces) List(opts v1.ListOptions) (result *network_v1.NetNamespaceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(netnamespacesResource, netnamespacesKind, opts), &network_v1.NetNamespaceList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &network_v1.NetNamespaceList{} + for _, item := range obj.(*network_v1.NetNamespaceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested netNamespaces. +func (c *FakeNetNamespaces) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(netnamespacesResource, opts)) +} + +// Create takes the representation of a netNamespace and creates it. Returns the server's representation of the netNamespace, and an error, if there is any. +func (c *FakeNetNamespaces) Create(netNamespace *network_v1.NetNamespace) (result *network_v1.NetNamespace, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(netnamespacesResource, netNamespace), &network_v1.NetNamespace{}) + if obj == nil { + return nil, err + } + return obj.(*network_v1.NetNamespace), err +} + +// Update takes the representation of a netNamespace and updates it. Returns the server's representation of the netNamespace, and an error, if there is any. +func (c *FakeNetNamespaces) Update(netNamespace *network_v1.NetNamespace) (result *network_v1.NetNamespace, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(netnamespacesResource, netNamespace), &network_v1.NetNamespace{}) + if obj == nil { + return nil, err + } + return obj.(*network_v1.NetNamespace), err +} + +// Delete takes name of the netNamespace and deletes it. Returns an error if one occurs. +func (c *FakeNetNamespaces) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(netnamespacesResource, name), &network_v1.NetNamespace{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeNetNamespaces) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(netnamespacesResource, listOptions) + + _, err := c.Fake.Invokes(action, &network_v1.NetNamespaceList{}) + return err +} + +// Patch applies the patch and returns the patched netNamespace. +func (c *FakeNetNamespaces) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *network_v1.NetNamespace, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(netnamespacesResource, name, data, subresources...), &network_v1.NetNamespace{}) + if obj == nil { + return nil, err + } + return obj.(*network_v1.NetNamespace), err +} diff --git a/network/clientset/versioned/typed/network/v1/fake/fake_network_client.go b/network/clientset/versioned/typed/network/v1/fake/fake_network_client.go new file mode 100644 index 0000000000..e116ae7f12 --- /dev/null +++ b/network/clientset/versioned/typed/network/v1/fake/fake_network_client.go @@ -0,0 +1,34 @@ +package fake + +import ( + v1 "github.com/openshift/client-go/network/clientset/versioned/typed/network/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeNetworkV1 struct { + *testing.Fake +} + +func (c *FakeNetworkV1) ClusterNetworks() v1.ClusterNetworkInterface { + return &FakeClusterNetworks{c} +} + +func (c *FakeNetworkV1) EgressNetworkPolicies(namespace string) v1.EgressNetworkPolicyInterface { + return &FakeEgressNetworkPolicies{c, namespace} +} + +func (c *FakeNetworkV1) HostSubnets() v1.HostSubnetInterface { + return &FakeHostSubnets{c} +} + +func (c *FakeNetworkV1) NetNamespaces() v1.NetNamespaceInterface { + return &FakeNetNamespaces{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeNetworkV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/network/clientset/versioned/typed/network/v1/generated_expansion.go b/network/clientset/versioned/typed/network/v1/generated_expansion.go new file mode 100644 index 0000000000..1fb12b22b1 --- /dev/null +++ b/network/clientset/versioned/typed/network/v1/generated_expansion.go @@ -0,0 +1,9 @@ +package v1 + +type ClusterNetworkExpansion interface{} + +type EgressNetworkPolicyExpansion interface{} + +type HostSubnetExpansion interface{} + +type NetNamespaceExpansion interface{} diff --git a/network/clientset/versioned/typed/network/v1/hostsubnet.go b/network/clientset/versioned/typed/network/v1/hostsubnet.go new file mode 100644 index 0000000000..3bb1bff0db --- /dev/null +++ b/network/clientset/versioned/typed/network/v1/hostsubnet.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/network/v1" + scheme "github.com/openshift/client-go/network/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// HostSubnetsGetter has a method to return a HostSubnetInterface. +// A group's client should implement this interface. +type HostSubnetsGetter interface { + HostSubnets() HostSubnetInterface +} + +// HostSubnetInterface has methods to work with HostSubnet resources. +type HostSubnetInterface interface { + Create(*v1.HostSubnet) (*v1.HostSubnet, error) + Update(*v1.HostSubnet) (*v1.HostSubnet, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.HostSubnet, error) + List(opts meta_v1.ListOptions) (*v1.HostSubnetList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.HostSubnet, err error) + HostSubnetExpansion +} + +// hostSubnets implements HostSubnetInterface +type hostSubnets struct { + client rest.Interface +} + +// newHostSubnets returns a HostSubnets +func newHostSubnets(c *NetworkV1Client) *hostSubnets { + return &hostSubnets{ + client: c.RESTClient(), + } +} + +// Get takes name of the hostSubnet, and returns the corresponding hostSubnet object, and an error if there is any. +func (c *hostSubnets) Get(name string, options meta_v1.GetOptions) (result *v1.HostSubnet, err error) { + result = &v1.HostSubnet{} + err = c.client.Get(). + Resource("hostsubnets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of HostSubnets that match those selectors. +func (c *hostSubnets) List(opts meta_v1.ListOptions) (result *v1.HostSubnetList, err error) { + result = &v1.HostSubnetList{} + err = c.client.Get(). + Resource("hostsubnets"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested hostSubnets. +func (c *hostSubnets) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("hostsubnets"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a hostSubnet and creates it. Returns the server's representation of the hostSubnet, and an error, if there is any. +func (c *hostSubnets) Create(hostSubnet *v1.HostSubnet) (result *v1.HostSubnet, err error) { + result = &v1.HostSubnet{} + err = c.client.Post(). + Resource("hostsubnets"). + Body(hostSubnet). + Do(). + Into(result) + return +} + +// Update takes the representation of a hostSubnet and updates it. Returns the server's representation of the hostSubnet, and an error, if there is any. +func (c *hostSubnets) Update(hostSubnet *v1.HostSubnet) (result *v1.HostSubnet, err error) { + result = &v1.HostSubnet{} + err = c.client.Put(). + Resource("hostsubnets"). + Name(hostSubnet.Name). + Body(hostSubnet). + Do(). + Into(result) + return +} + +// Delete takes name of the hostSubnet and deletes it. Returns an error if one occurs. +func (c *hostSubnets) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("hostsubnets"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *hostSubnets) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("hostsubnets"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched hostSubnet. +func (c *hostSubnets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.HostSubnet, err error) { + result = &v1.HostSubnet{} + err = c.client.Patch(pt). + Resource("hostsubnets"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/network/clientset/versioned/typed/network/v1/netnamespace.go b/network/clientset/versioned/typed/network/v1/netnamespace.go new file mode 100644 index 0000000000..e9d99fd0f2 --- /dev/null +++ b/network/clientset/versioned/typed/network/v1/netnamespace.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/network/v1" + scheme "github.com/openshift/client-go/network/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// NetNamespacesGetter has a method to return a NetNamespaceInterface. +// A group's client should implement this interface. +type NetNamespacesGetter interface { + NetNamespaces() NetNamespaceInterface +} + +// NetNamespaceInterface has methods to work with NetNamespace resources. +type NetNamespaceInterface interface { + Create(*v1.NetNamespace) (*v1.NetNamespace, error) + Update(*v1.NetNamespace) (*v1.NetNamespace, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.NetNamespace, error) + List(opts meta_v1.ListOptions) (*v1.NetNamespaceList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.NetNamespace, err error) + NetNamespaceExpansion +} + +// netNamespaces implements NetNamespaceInterface +type netNamespaces struct { + client rest.Interface +} + +// newNetNamespaces returns a NetNamespaces +func newNetNamespaces(c *NetworkV1Client) *netNamespaces { + return &netNamespaces{ + client: c.RESTClient(), + } +} + +// Get takes name of the netNamespace, and returns the corresponding netNamespace object, and an error if there is any. +func (c *netNamespaces) Get(name string, options meta_v1.GetOptions) (result *v1.NetNamespace, err error) { + result = &v1.NetNamespace{} + err = c.client.Get(). + Resource("netnamespaces"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of NetNamespaces that match those selectors. +func (c *netNamespaces) List(opts meta_v1.ListOptions) (result *v1.NetNamespaceList, err error) { + result = &v1.NetNamespaceList{} + err = c.client.Get(). + Resource("netnamespaces"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested netNamespaces. +func (c *netNamespaces) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("netnamespaces"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a netNamespace and creates it. Returns the server's representation of the netNamespace, and an error, if there is any. +func (c *netNamespaces) Create(netNamespace *v1.NetNamespace) (result *v1.NetNamespace, err error) { + result = &v1.NetNamespace{} + err = c.client.Post(). + Resource("netnamespaces"). + Body(netNamespace). + Do(). + Into(result) + return +} + +// Update takes the representation of a netNamespace and updates it. Returns the server's representation of the netNamespace, and an error, if there is any. +func (c *netNamespaces) Update(netNamespace *v1.NetNamespace) (result *v1.NetNamespace, err error) { + result = &v1.NetNamespace{} + err = c.client.Put(). + Resource("netnamespaces"). + Name(netNamespace.Name). + Body(netNamespace). + Do(). + Into(result) + return +} + +// Delete takes name of the netNamespace and deletes it. Returns an error if one occurs. +func (c *netNamespaces) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("netnamespaces"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *netNamespaces) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("netnamespaces"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched netNamespace. +func (c *netNamespaces) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.NetNamespace, err error) { + result = &v1.NetNamespace{} + err = c.client.Patch(pt). + Resource("netnamespaces"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/network/clientset/versioned/typed/network/v1/network_client.go b/network/clientset/versioned/typed/network/v1/network_client.go new file mode 100644 index 0000000000..b8aa815f6d --- /dev/null +++ b/network/clientset/versioned/typed/network/v1/network_client.go @@ -0,0 +1,87 @@ +package v1 + +import ( + v1 "github.com/openshift/api/network/v1" + "github.com/openshift/client-go/network/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type NetworkV1Interface interface { + RESTClient() rest.Interface + ClusterNetworksGetter + EgressNetworkPoliciesGetter + HostSubnetsGetter + NetNamespacesGetter +} + +// NetworkV1Client is used to interact with features provided by the network.openshift.io group. +type NetworkV1Client struct { + restClient rest.Interface +} + +func (c *NetworkV1Client) ClusterNetworks() ClusterNetworkInterface { + return newClusterNetworks(c) +} + +func (c *NetworkV1Client) EgressNetworkPolicies(namespace string) EgressNetworkPolicyInterface { + return newEgressNetworkPolicies(c, namespace) +} + +func (c *NetworkV1Client) HostSubnets() HostSubnetInterface { + return newHostSubnets(c) +} + +func (c *NetworkV1Client) NetNamespaces() NetNamespaceInterface { + return newNetNamespaces(c) +} + +// NewForConfig creates a new NetworkV1Client for the given config. +func NewForConfig(c *rest.Config) (*NetworkV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &NetworkV1Client{client}, nil +} + +// NewForConfigOrDie creates a new NetworkV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *NetworkV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new NetworkV1Client for the given RESTClient. +func New(c rest.Interface) *NetworkV1Client { + return &NetworkV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *NetworkV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/network/informers/externalversions/factory.go b/network/informers/externalversions/factory.go new file mode 100644 index 0000000000..9866af09d7 --- /dev/null +++ b/network/informers/externalversions/factory.go @@ -0,0 +1,102 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + versioned "github.com/openshift/client-go/network/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/network/informers/externalversions/internalinterfaces" + network "github.com/openshift/client-go/network/informers/externalversions/network" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + reflect "reflect" + sync "sync" + time "time" +) + +type sharedInformerFactory struct { + client versioned.Interface + lock sync.Mutex + defaultResync time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return &sharedInformerFactory{ + client: client, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + } +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + informer = newFunc(f.client, f.defaultResync) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Network() network.Interface +} + +func (f *sharedInformerFactory) Network() network.Interface { + return network.New(f) +} diff --git a/network/informers/externalversions/generic.go b/network/informers/externalversions/generic.go new file mode 100644 index 0000000000..06f059c90f --- /dev/null +++ b/network/informers/externalversions/generic.go @@ -0,0 +1,51 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + "fmt" + v1 "github.com/openshift/api/network/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=Network, Version=V1 + case v1.SchemeGroupVersion.WithResource("clusternetworks"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Network().V1().ClusterNetworks().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("egressnetworkpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Network().V1().EgressNetworkPolicies().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("hostsubnets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Network().V1().HostSubnets().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("netnamespaces"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Network().V1().NetNamespaces().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/network/informers/externalversions/internalinterfaces/factory_interfaces.go b/network/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..57aad1968f --- /dev/null +++ b/network/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,18 @@ +// This file was automatically generated by informer-gen + +package internalinterfaces + +import ( + versioned "github.com/openshift/client-go/network/clientset/versioned" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} diff --git a/network/informers/externalversions/network/interface.go b/network/informers/externalversions/network/interface.go new file mode 100644 index 0000000000..ac8b3dcbf0 --- /dev/null +++ b/network/informers/externalversions/network/interface.go @@ -0,0 +1,28 @@ +// This file was automatically generated by informer-gen + +package network + +import ( + internalinterfaces "github.com/openshift/client-go/network/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/network/informers/externalversions/network/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &group{f} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.SharedInformerFactory) +} diff --git a/network/informers/externalversions/network/v1/clusternetwork.go b/network/informers/externalversions/network/v1/clusternetwork.go new file mode 100644 index 0000000000..85c7079292 --- /dev/null +++ b/network/informers/externalversions/network/v1/clusternetwork.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + network_v1 "github.com/openshift/api/network/v1" + versioned "github.com/openshift/client-go/network/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/network/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/network/listers/network/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// ClusterNetworkInformer provides access to a shared informer and lister for +// ClusterNetworks. +type ClusterNetworkInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ClusterNetworkLister +} + +type clusterNetworkInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewClusterNetworkInformer constructs a new informer for ClusterNetwork type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterNetworkInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.NetworkV1().ClusterNetworks().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.NetworkV1().ClusterNetworks().Watch(options) + }, + }, + &network_v1.ClusterNetwork{}, + resyncPeriod, + indexers, + ) +} + +func defaultClusterNetworkInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewClusterNetworkInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *clusterNetworkInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&network_v1.ClusterNetwork{}, defaultClusterNetworkInformer) +} + +func (f *clusterNetworkInformer) Lister() v1.ClusterNetworkLister { + return v1.NewClusterNetworkLister(f.Informer().GetIndexer()) +} diff --git a/network/informers/externalversions/network/v1/egressnetworkpolicy.go b/network/informers/externalversions/network/v1/egressnetworkpolicy.go new file mode 100644 index 0000000000..255c095c3d --- /dev/null +++ b/network/informers/externalversions/network/v1/egressnetworkpolicy.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + network_v1 "github.com/openshift/api/network/v1" + versioned "github.com/openshift/client-go/network/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/network/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/network/listers/network/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// EgressNetworkPolicyInformer provides access to a shared informer and lister for +// EgressNetworkPolicies. +type EgressNetworkPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.EgressNetworkPolicyLister +} + +type egressNetworkPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewEgressNetworkPolicyInformer constructs a new informer for EgressNetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEgressNetworkPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.NetworkV1().EgressNetworkPolicies(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.NetworkV1().EgressNetworkPolicies(namespace).Watch(options) + }, + }, + &network_v1.EgressNetworkPolicy{}, + resyncPeriod, + indexers, + ) +} + +func defaultEgressNetworkPolicyInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewEgressNetworkPolicyInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *egressNetworkPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&network_v1.EgressNetworkPolicy{}, defaultEgressNetworkPolicyInformer) +} + +func (f *egressNetworkPolicyInformer) Lister() v1.EgressNetworkPolicyLister { + return v1.NewEgressNetworkPolicyLister(f.Informer().GetIndexer()) +} diff --git a/network/informers/externalversions/network/v1/hostsubnet.go b/network/informers/externalversions/network/v1/hostsubnet.go new file mode 100644 index 0000000000..af18f9f8df --- /dev/null +++ b/network/informers/externalversions/network/v1/hostsubnet.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + network_v1 "github.com/openshift/api/network/v1" + versioned "github.com/openshift/client-go/network/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/network/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/network/listers/network/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// HostSubnetInformer provides access to a shared informer and lister for +// HostSubnets. +type HostSubnetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.HostSubnetLister +} + +type hostSubnetInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewHostSubnetInformer constructs a new informer for HostSubnet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHostSubnetInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.NetworkV1().HostSubnets().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.NetworkV1().HostSubnets().Watch(options) + }, + }, + &network_v1.HostSubnet{}, + resyncPeriod, + indexers, + ) +} + +func defaultHostSubnetInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewHostSubnetInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *hostSubnetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&network_v1.HostSubnet{}, defaultHostSubnetInformer) +} + +func (f *hostSubnetInformer) Lister() v1.HostSubnetLister { + return v1.NewHostSubnetLister(f.Informer().GetIndexer()) +} diff --git a/network/informers/externalversions/network/v1/interface.go b/network/informers/externalversions/network/v1/interface.go new file mode 100644 index 0000000000..7663bad918 --- /dev/null +++ b/network/informers/externalversions/network/v1/interface.go @@ -0,0 +1,48 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + internalinterfaces "github.com/openshift/client-go/network/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ClusterNetworks returns a ClusterNetworkInformer. + ClusterNetworks() ClusterNetworkInformer + // EgressNetworkPolicies returns a EgressNetworkPolicyInformer. + EgressNetworkPolicies() EgressNetworkPolicyInformer + // HostSubnets returns a HostSubnetInformer. + HostSubnets() HostSubnetInformer + // NetNamespaces returns a NetNamespaceInformer. + NetNamespaces() NetNamespaceInformer +} + +type version struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &version{f} +} + +// ClusterNetworks returns a ClusterNetworkInformer. +func (v *version) ClusterNetworks() ClusterNetworkInformer { + return &clusterNetworkInformer{factory: v.SharedInformerFactory} +} + +// EgressNetworkPolicies returns a EgressNetworkPolicyInformer. +func (v *version) EgressNetworkPolicies() EgressNetworkPolicyInformer { + return &egressNetworkPolicyInformer{factory: v.SharedInformerFactory} +} + +// HostSubnets returns a HostSubnetInformer. +func (v *version) HostSubnets() HostSubnetInformer { + return &hostSubnetInformer{factory: v.SharedInformerFactory} +} + +// NetNamespaces returns a NetNamespaceInformer. +func (v *version) NetNamespaces() NetNamespaceInformer { + return &netNamespaceInformer{factory: v.SharedInformerFactory} +} diff --git a/network/informers/externalversions/network/v1/netnamespace.go b/network/informers/externalversions/network/v1/netnamespace.go new file mode 100644 index 0000000000..ab5c7624a2 --- /dev/null +++ b/network/informers/externalversions/network/v1/netnamespace.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + network_v1 "github.com/openshift/api/network/v1" + versioned "github.com/openshift/client-go/network/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/network/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/network/listers/network/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// NetNamespaceInformer provides access to a shared informer and lister for +// NetNamespaces. +type NetNamespaceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.NetNamespaceLister +} + +type netNamespaceInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewNetNamespaceInformer constructs a new informer for NetNamespace type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNetNamespaceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.NetworkV1().NetNamespaces().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.NetworkV1().NetNamespaces().Watch(options) + }, + }, + &network_v1.NetNamespace{}, + resyncPeriod, + indexers, + ) +} + +func defaultNetNamespaceInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewNetNamespaceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *netNamespaceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&network_v1.NetNamespace{}, defaultNetNamespaceInformer) +} + +func (f *netNamespaceInformer) Lister() v1.NetNamespaceLister { + return v1.NewNetNamespaceLister(f.Informer().GetIndexer()) +} diff --git a/network/listers/network/v1/clusternetwork.go b/network/listers/network/v1/clusternetwork.go new file mode 100644 index 0000000000..cd444eaaf8 --- /dev/null +++ b/network/listers/network/v1/clusternetwork.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/network/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterNetworkLister helps list ClusterNetworks. +type ClusterNetworkLister interface { + // List lists all ClusterNetworks in the indexer. + List(selector labels.Selector) (ret []*v1.ClusterNetwork, err error) + // Get retrieves the ClusterNetwork from the index for a given name. + Get(name string) (*v1.ClusterNetwork, error) + ClusterNetworkListerExpansion +} + +// clusterNetworkLister implements the ClusterNetworkLister interface. +type clusterNetworkLister struct { + indexer cache.Indexer +} + +// NewClusterNetworkLister returns a new ClusterNetworkLister. +func NewClusterNetworkLister(indexer cache.Indexer) ClusterNetworkLister { + return &clusterNetworkLister{indexer: indexer} +} + +// List lists all ClusterNetworks in the indexer. +func (s *clusterNetworkLister) List(selector labels.Selector) (ret []*v1.ClusterNetwork, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterNetwork)) + }) + return ret, err +} + +// Get retrieves the ClusterNetwork from the index for a given name. +func (s *clusterNetworkLister) Get(name string) (*v1.ClusterNetwork, error) { + key := &v1.ClusterNetwork{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("clusternetwork"), name) + } + return obj.(*v1.ClusterNetwork), nil +} diff --git a/network/listers/network/v1/egressnetworkpolicy.go b/network/listers/network/v1/egressnetworkpolicy.go new file mode 100644 index 0000000000..ef9b2c7a3d --- /dev/null +++ b/network/listers/network/v1/egressnetworkpolicy.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/network/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EgressNetworkPolicyLister helps list EgressNetworkPolicies. +type EgressNetworkPolicyLister interface { + // List lists all EgressNetworkPolicies in the indexer. + List(selector labels.Selector) (ret []*v1.EgressNetworkPolicy, err error) + // EgressNetworkPolicies returns an object that can list and get EgressNetworkPolicies. + EgressNetworkPolicies(namespace string) EgressNetworkPolicyNamespaceLister + EgressNetworkPolicyListerExpansion +} + +// egressNetworkPolicyLister implements the EgressNetworkPolicyLister interface. +type egressNetworkPolicyLister struct { + indexer cache.Indexer +} + +// NewEgressNetworkPolicyLister returns a new EgressNetworkPolicyLister. +func NewEgressNetworkPolicyLister(indexer cache.Indexer) EgressNetworkPolicyLister { + return &egressNetworkPolicyLister{indexer: indexer} +} + +// List lists all EgressNetworkPolicies in the indexer. +func (s *egressNetworkPolicyLister) List(selector labels.Selector) (ret []*v1.EgressNetworkPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.EgressNetworkPolicy)) + }) + return ret, err +} + +// EgressNetworkPolicies returns an object that can list and get EgressNetworkPolicies. +func (s *egressNetworkPolicyLister) EgressNetworkPolicies(namespace string) EgressNetworkPolicyNamespaceLister { + return egressNetworkPolicyNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EgressNetworkPolicyNamespaceLister helps list and get EgressNetworkPolicies. +type EgressNetworkPolicyNamespaceLister interface { + // List lists all EgressNetworkPolicies in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.EgressNetworkPolicy, err error) + // Get retrieves the EgressNetworkPolicy from the indexer for a given namespace and name. + Get(name string) (*v1.EgressNetworkPolicy, error) + EgressNetworkPolicyNamespaceListerExpansion +} + +// egressNetworkPolicyNamespaceLister implements the EgressNetworkPolicyNamespaceLister +// interface. +type egressNetworkPolicyNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all EgressNetworkPolicies in the indexer for a given namespace. +func (s egressNetworkPolicyNamespaceLister) List(selector labels.Selector) (ret []*v1.EgressNetworkPolicy, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.EgressNetworkPolicy)) + }) + return ret, err +} + +// Get retrieves the EgressNetworkPolicy from the indexer for a given namespace and name. +func (s egressNetworkPolicyNamespaceLister) Get(name string) (*v1.EgressNetworkPolicy, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("egressnetworkpolicy"), name) + } + return obj.(*v1.EgressNetworkPolicy), nil +} diff --git a/network/listers/network/v1/expansion_generated.go b/network/listers/network/v1/expansion_generated.go new file mode 100644 index 0000000000..3a2898daa2 --- /dev/null +++ b/network/listers/network/v1/expansion_generated.go @@ -0,0 +1,23 @@ +// This file was automatically generated by lister-gen + +package v1 + +// ClusterNetworkListerExpansion allows custom methods to be added to +// ClusterNetworkLister. +type ClusterNetworkListerExpansion interface{} + +// EgressNetworkPolicyListerExpansion allows custom methods to be added to +// EgressNetworkPolicyLister. +type EgressNetworkPolicyListerExpansion interface{} + +// EgressNetworkPolicyNamespaceListerExpansion allows custom methods to be added to +// EgressNetworkPolicyNamespaceLister. +type EgressNetworkPolicyNamespaceListerExpansion interface{} + +// HostSubnetListerExpansion allows custom methods to be added to +// HostSubnetLister. +type HostSubnetListerExpansion interface{} + +// NetNamespaceListerExpansion allows custom methods to be added to +// NetNamespaceLister. +type NetNamespaceListerExpansion interface{} diff --git a/network/listers/network/v1/hostsubnet.go b/network/listers/network/v1/hostsubnet.go new file mode 100644 index 0000000000..c565f67dd9 --- /dev/null +++ b/network/listers/network/v1/hostsubnet.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/network/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// HostSubnetLister helps list HostSubnets. +type HostSubnetLister interface { + // List lists all HostSubnets in the indexer. + List(selector labels.Selector) (ret []*v1.HostSubnet, err error) + // Get retrieves the HostSubnet from the index for a given name. + Get(name string) (*v1.HostSubnet, error) + HostSubnetListerExpansion +} + +// hostSubnetLister implements the HostSubnetLister interface. +type hostSubnetLister struct { + indexer cache.Indexer +} + +// NewHostSubnetLister returns a new HostSubnetLister. +func NewHostSubnetLister(indexer cache.Indexer) HostSubnetLister { + return &hostSubnetLister{indexer: indexer} +} + +// List lists all HostSubnets in the indexer. +func (s *hostSubnetLister) List(selector labels.Selector) (ret []*v1.HostSubnet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.HostSubnet)) + }) + return ret, err +} + +// Get retrieves the HostSubnet from the index for a given name. +func (s *hostSubnetLister) Get(name string) (*v1.HostSubnet, error) { + key := &v1.HostSubnet{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("hostsubnet"), name) + } + return obj.(*v1.HostSubnet), nil +} diff --git a/network/listers/network/v1/netnamespace.go b/network/listers/network/v1/netnamespace.go new file mode 100644 index 0000000000..6150c78b79 --- /dev/null +++ b/network/listers/network/v1/netnamespace.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/network/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// NetNamespaceLister helps list NetNamespaces. +type NetNamespaceLister interface { + // List lists all NetNamespaces in the indexer. + List(selector labels.Selector) (ret []*v1.NetNamespace, err error) + // Get retrieves the NetNamespace from the index for a given name. + Get(name string) (*v1.NetNamespace, error) + NetNamespaceListerExpansion +} + +// netNamespaceLister implements the NetNamespaceLister interface. +type netNamespaceLister struct { + indexer cache.Indexer +} + +// NewNetNamespaceLister returns a new NetNamespaceLister. +func NewNetNamespaceLister(indexer cache.Indexer) NetNamespaceLister { + return &netNamespaceLister{indexer: indexer} +} + +// List lists all NetNamespaces in the indexer. +func (s *netNamespaceLister) List(selector labels.Selector) (ret []*v1.NetNamespace, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.NetNamespace)) + }) + return ret, err +} + +// Get retrieves the NetNamespace from the index for a given name. +func (s *netNamespaceLister) Get(name string) (*v1.NetNamespace, error) { + key := &v1.NetNamespace{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("netnamespace"), name) + } + return obj.(*v1.NetNamespace), nil +} diff --git a/oauth/clientset/versioned/clientset.go b/oauth/clientset/versioned/clientset.go new file mode 100644 index 0000000000..05a006eefd --- /dev/null +++ b/oauth/clientset/versioned/clientset.go @@ -0,0 +1,82 @@ +package versioned + +import ( + glog "github.com/golang/glog" + oauthv1 "github.com/openshift/client-go/oauth/clientset/versioned/typed/oauth/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + OauthV1() oauthv1.OauthV1Interface + // Deprecated: please explicitly pick a version if possible. + Oauth() oauthv1.OauthV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + oauthV1 *oauthv1.OauthV1Client +} + +// OauthV1 retrieves the OauthV1Client +func (c *Clientset) OauthV1() oauthv1.OauthV1Interface { + return c.oauthV1 +} + +// Deprecated: Oauth retrieves the default version of OauthClient. +// Please explicitly pick a version. +func (c *Clientset) Oauth() oauthv1.OauthV1Interface { + return c.oauthV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.oauthV1, err = oauthv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.oauthV1 = oauthv1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.oauthV1 = oauthv1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/oauth/clientset/versioned/doc.go b/oauth/clientset/versioned/doc.go new file mode 100644 index 0000000000..72f92921e6 --- /dev/null +++ b/oauth/clientset/versioned/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated clientset. +package versioned diff --git a/oauth/clientset/versioned/fake/clientset_generated.go b/oauth/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..b4e94c7575 --- /dev/null +++ b/oauth/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,55 @@ +package fake + +import ( + clientset "github.com/openshift/client-go/oauth/clientset/versioned" + oauthv1 "github.com/openshift/client-go/oauth/clientset/versioned/typed/oauth/v1" + fakeoauthv1 "github.com/openshift/client-go/oauth/clientset/versioned/typed/oauth/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := testing.Fake{} + fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) + fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// OauthV1 retrieves the OauthV1Client +func (c *Clientset) OauthV1() oauthv1.OauthV1Interface { + return &fakeoauthv1.FakeOauthV1{Fake: &c.Fake} +} + +// Oauth retrieves the OauthV1Client +func (c *Clientset) Oauth() oauthv1.OauthV1Interface { + return &fakeoauthv1.FakeOauthV1{Fake: &c.Fake} +} diff --git a/oauth/clientset/versioned/fake/doc.go b/oauth/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..760aaa8253 --- /dev/null +++ b/oauth/clientset/versioned/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated fake clientset. +package fake diff --git a/oauth/clientset/versioned/fake/register.go b/oauth/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..e0a7b46901 --- /dev/null +++ b/oauth/clientset/versioned/fake/register.go @@ -0,0 +1,37 @@ +package fake + +import ( + oauthv1 "github.com/openshift/api/oauth/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + oauthv1.AddToScheme(scheme) + +} diff --git a/oauth/clientset/versioned/scheme/doc.go b/oauth/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..d1c53d03b2 --- /dev/null +++ b/oauth/clientset/versioned/scheme/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/oauth/clientset/versioned/scheme/register.go b/oauth/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..356f8ff832 --- /dev/null +++ b/oauth/clientset/versioned/scheme/register.go @@ -0,0 +1,37 @@ +package scheme + +import ( + oauthv1 "github.com/openshift/api/oauth/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + oauthv1.AddToScheme(scheme) + +} diff --git a/oauth/clientset/versioned/typed/oauth/v1/doc.go b/oauth/clientset/versioned/typed/oauth/v1/doc.go new file mode 100644 index 0000000000..0e93c2c5e7 --- /dev/null +++ b/oauth/clientset/versioned/typed/oauth/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated typed clients. +package v1 diff --git a/oauth/clientset/versioned/typed/oauth/v1/fake/doc.go b/oauth/clientset/versioned/typed/oauth/v1/fake/doc.go new file mode 100644 index 0000000000..e3bbd12a2b --- /dev/null +++ b/oauth/clientset/versioned/typed/oauth/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// Package fake has the automatically generated clients. +package fake diff --git a/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauth_client.go b/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauth_client.go new file mode 100644 index 0000000000..3d4af06250 --- /dev/null +++ b/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauth_client.go @@ -0,0 +1,34 @@ +package fake + +import ( + v1 "github.com/openshift/client-go/oauth/clientset/versioned/typed/oauth/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeOauthV1 struct { + *testing.Fake +} + +func (c *FakeOauthV1) OAuthAccessTokens() v1.OAuthAccessTokenInterface { + return &FakeOAuthAccessTokens{c} +} + +func (c *FakeOauthV1) OAuthAuthorizeTokens() v1.OAuthAuthorizeTokenInterface { + return &FakeOAuthAuthorizeTokens{c} +} + +func (c *FakeOauthV1) OAuthClients() v1.OAuthClientInterface { + return &FakeOAuthClients{c} +} + +func (c *FakeOauthV1) OAuthClientAuthorizations() v1.OAuthClientAuthorizationInterface { + return &FakeOAuthClientAuthorizations{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeOauthV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthaccesstoken.go b/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthaccesstoken.go new file mode 100644 index 0000000000..1d2aeb4e8a --- /dev/null +++ b/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthaccesstoken.go @@ -0,0 +1,102 @@ +package fake + +import ( + oauth_v1 "github.com/openshift/api/oauth/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeOAuthAccessTokens implements OAuthAccessTokenInterface +type FakeOAuthAccessTokens struct { + Fake *FakeOauthV1 +} + +var oauthaccesstokensResource = schema.GroupVersionResource{Group: "oauth.openshift.io", Version: "v1", Resource: "oauthaccesstokens"} + +var oauthaccesstokensKind = schema.GroupVersionKind{Group: "oauth.openshift.io", Version: "v1", Kind: "OAuthAccessToken"} + +// Get takes name of the oAuthAccessToken, and returns the corresponding oAuthAccessToken object, and an error if there is any. +func (c *FakeOAuthAccessTokens) Get(name string, options v1.GetOptions) (result *oauth_v1.OAuthAccessToken, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(oauthaccesstokensResource, name), &oauth_v1.OAuthAccessToken{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthAccessToken), err +} + +// List takes label and field selectors, and returns the list of OAuthAccessTokens that match those selectors. +func (c *FakeOAuthAccessTokens) List(opts v1.ListOptions) (result *oauth_v1.OAuthAccessTokenList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(oauthaccesstokensResource, oauthaccesstokensKind, opts), &oauth_v1.OAuthAccessTokenList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &oauth_v1.OAuthAccessTokenList{} + for _, item := range obj.(*oauth_v1.OAuthAccessTokenList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested oAuthAccessTokens. +func (c *FakeOAuthAccessTokens) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(oauthaccesstokensResource, opts)) +} + +// Create takes the representation of a oAuthAccessToken and creates it. Returns the server's representation of the oAuthAccessToken, and an error, if there is any. +func (c *FakeOAuthAccessTokens) Create(oAuthAccessToken *oauth_v1.OAuthAccessToken) (result *oauth_v1.OAuthAccessToken, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(oauthaccesstokensResource, oAuthAccessToken), &oauth_v1.OAuthAccessToken{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthAccessToken), err +} + +// Update takes the representation of a oAuthAccessToken and updates it. Returns the server's representation of the oAuthAccessToken, and an error, if there is any. +func (c *FakeOAuthAccessTokens) Update(oAuthAccessToken *oauth_v1.OAuthAccessToken) (result *oauth_v1.OAuthAccessToken, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(oauthaccesstokensResource, oAuthAccessToken), &oauth_v1.OAuthAccessToken{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthAccessToken), err +} + +// Delete takes name of the oAuthAccessToken and deletes it. Returns an error if one occurs. +func (c *FakeOAuthAccessTokens) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(oauthaccesstokensResource, name), &oauth_v1.OAuthAccessToken{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeOAuthAccessTokens) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(oauthaccesstokensResource, listOptions) + + _, err := c.Fake.Invokes(action, &oauth_v1.OAuthAccessTokenList{}) + return err +} + +// Patch applies the patch and returns the patched oAuthAccessToken. +func (c *FakeOAuthAccessTokens) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *oauth_v1.OAuthAccessToken, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(oauthaccesstokensResource, name, data, subresources...), &oauth_v1.OAuthAccessToken{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthAccessToken), err +} diff --git a/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthauthorizetoken.go b/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthauthorizetoken.go new file mode 100644 index 0000000000..703542da66 --- /dev/null +++ b/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthauthorizetoken.go @@ -0,0 +1,102 @@ +package fake + +import ( + oauth_v1 "github.com/openshift/api/oauth/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeOAuthAuthorizeTokens implements OAuthAuthorizeTokenInterface +type FakeOAuthAuthorizeTokens struct { + Fake *FakeOauthV1 +} + +var oauthauthorizetokensResource = schema.GroupVersionResource{Group: "oauth.openshift.io", Version: "v1", Resource: "oauthauthorizetokens"} + +var oauthauthorizetokensKind = schema.GroupVersionKind{Group: "oauth.openshift.io", Version: "v1", Kind: "OAuthAuthorizeToken"} + +// Get takes name of the oAuthAuthorizeToken, and returns the corresponding oAuthAuthorizeToken object, and an error if there is any. +func (c *FakeOAuthAuthorizeTokens) Get(name string, options v1.GetOptions) (result *oauth_v1.OAuthAuthorizeToken, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(oauthauthorizetokensResource, name), &oauth_v1.OAuthAuthorizeToken{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthAuthorizeToken), err +} + +// List takes label and field selectors, and returns the list of OAuthAuthorizeTokens that match those selectors. +func (c *FakeOAuthAuthorizeTokens) List(opts v1.ListOptions) (result *oauth_v1.OAuthAuthorizeTokenList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(oauthauthorizetokensResource, oauthauthorizetokensKind, opts), &oauth_v1.OAuthAuthorizeTokenList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &oauth_v1.OAuthAuthorizeTokenList{} + for _, item := range obj.(*oauth_v1.OAuthAuthorizeTokenList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested oAuthAuthorizeTokens. +func (c *FakeOAuthAuthorizeTokens) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(oauthauthorizetokensResource, opts)) +} + +// Create takes the representation of a oAuthAuthorizeToken and creates it. Returns the server's representation of the oAuthAuthorizeToken, and an error, if there is any. +func (c *FakeOAuthAuthorizeTokens) Create(oAuthAuthorizeToken *oauth_v1.OAuthAuthorizeToken) (result *oauth_v1.OAuthAuthorizeToken, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(oauthauthorizetokensResource, oAuthAuthorizeToken), &oauth_v1.OAuthAuthorizeToken{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthAuthorizeToken), err +} + +// Update takes the representation of a oAuthAuthorizeToken and updates it. Returns the server's representation of the oAuthAuthorizeToken, and an error, if there is any. +func (c *FakeOAuthAuthorizeTokens) Update(oAuthAuthorizeToken *oauth_v1.OAuthAuthorizeToken) (result *oauth_v1.OAuthAuthorizeToken, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(oauthauthorizetokensResource, oAuthAuthorizeToken), &oauth_v1.OAuthAuthorizeToken{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthAuthorizeToken), err +} + +// Delete takes name of the oAuthAuthorizeToken and deletes it. Returns an error if one occurs. +func (c *FakeOAuthAuthorizeTokens) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(oauthauthorizetokensResource, name), &oauth_v1.OAuthAuthorizeToken{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeOAuthAuthorizeTokens) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(oauthauthorizetokensResource, listOptions) + + _, err := c.Fake.Invokes(action, &oauth_v1.OAuthAuthorizeTokenList{}) + return err +} + +// Patch applies the patch and returns the patched oAuthAuthorizeToken. +func (c *FakeOAuthAuthorizeTokens) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *oauth_v1.OAuthAuthorizeToken, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(oauthauthorizetokensResource, name, data, subresources...), &oauth_v1.OAuthAuthorizeToken{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthAuthorizeToken), err +} diff --git a/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthclient.go b/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthclient.go new file mode 100644 index 0000000000..d919fca135 --- /dev/null +++ b/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthclient.go @@ -0,0 +1,102 @@ +package fake + +import ( + oauth_v1 "github.com/openshift/api/oauth/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeOAuthClients implements OAuthClientInterface +type FakeOAuthClients struct { + Fake *FakeOauthV1 +} + +var oauthclientsResource = schema.GroupVersionResource{Group: "oauth.openshift.io", Version: "v1", Resource: "oauthclients"} + +var oauthclientsKind = schema.GroupVersionKind{Group: "oauth.openshift.io", Version: "v1", Kind: "OAuthClient"} + +// Get takes name of the oAuthClient, and returns the corresponding oAuthClient object, and an error if there is any. +func (c *FakeOAuthClients) Get(name string, options v1.GetOptions) (result *oauth_v1.OAuthClient, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(oauthclientsResource, name), &oauth_v1.OAuthClient{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthClient), err +} + +// List takes label and field selectors, and returns the list of OAuthClients that match those selectors. +func (c *FakeOAuthClients) List(opts v1.ListOptions) (result *oauth_v1.OAuthClientList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(oauthclientsResource, oauthclientsKind, opts), &oauth_v1.OAuthClientList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &oauth_v1.OAuthClientList{} + for _, item := range obj.(*oauth_v1.OAuthClientList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested oAuthClients. +func (c *FakeOAuthClients) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(oauthclientsResource, opts)) +} + +// Create takes the representation of a oAuthClient and creates it. Returns the server's representation of the oAuthClient, and an error, if there is any. +func (c *FakeOAuthClients) Create(oAuthClient *oauth_v1.OAuthClient) (result *oauth_v1.OAuthClient, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(oauthclientsResource, oAuthClient), &oauth_v1.OAuthClient{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthClient), err +} + +// Update takes the representation of a oAuthClient and updates it. Returns the server's representation of the oAuthClient, and an error, if there is any. +func (c *FakeOAuthClients) Update(oAuthClient *oauth_v1.OAuthClient) (result *oauth_v1.OAuthClient, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(oauthclientsResource, oAuthClient), &oauth_v1.OAuthClient{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthClient), err +} + +// Delete takes name of the oAuthClient and deletes it. Returns an error if one occurs. +func (c *FakeOAuthClients) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(oauthclientsResource, name), &oauth_v1.OAuthClient{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeOAuthClients) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(oauthclientsResource, listOptions) + + _, err := c.Fake.Invokes(action, &oauth_v1.OAuthClientList{}) + return err +} + +// Patch applies the patch and returns the patched oAuthClient. +func (c *FakeOAuthClients) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *oauth_v1.OAuthClient, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(oauthclientsResource, name, data, subresources...), &oauth_v1.OAuthClient{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthClient), err +} diff --git a/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthclientauthorization.go b/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthclientauthorization.go new file mode 100644 index 0000000000..d70257c339 --- /dev/null +++ b/oauth/clientset/versioned/typed/oauth/v1/fake/fake_oauthclientauthorization.go @@ -0,0 +1,102 @@ +package fake + +import ( + oauth_v1 "github.com/openshift/api/oauth/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeOAuthClientAuthorizations implements OAuthClientAuthorizationInterface +type FakeOAuthClientAuthorizations struct { + Fake *FakeOauthV1 +} + +var oauthclientauthorizationsResource = schema.GroupVersionResource{Group: "oauth.openshift.io", Version: "v1", Resource: "oauthclientauthorizations"} + +var oauthclientauthorizationsKind = schema.GroupVersionKind{Group: "oauth.openshift.io", Version: "v1", Kind: "OAuthClientAuthorization"} + +// Get takes name of the oAuthClientAuthorization, and returns the corresponding oAuthClientAuthorization object, and an error if there is any. +func (c *FakeOAuthClientAuthorizations) Get(name string, options v1.GetOptions) (result *oauth_v1.OAuthClientAuthorization, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(oauthclientauthorizationsResource, name), &oauth_v1.OAuthClientAuthorization{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthClientAuthorization), err +} + +// List takes label and field selectors, and returns the list of OAuthClientAuthorizations that match those selectors. +func (c *FakeOAuthClientAuthorizations) List(opts v1.ListOptions) (result *oauth_v1.OAuthClientAuthorizationList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(oauthclientauthorizationsResource, oauthclientauthorizationsKind, opts), &oauth_v1.OAuthClientAuthorizationList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &oauth_v1.OAuthClientAuthorizationList{} + for _, item := range obj.(*oauth_v1.OAuthClientAuthorizationList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested oAuthClientAuthorizations. +func (c *FakeOAuthClientAuthorizations) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(oauthclientauthorizationsResource, opts)) +} + +// Create takes the representation of a oAuthClientAuthorization and creates it. Returns the server's representation of the oAuthClientAuthorization, and an error, if there is any. +func (c *FakeOAuthClientAuthorizations) Create(oAuthClientAuthorization *oauth_v1.OAuthClientAuthorization) (result *oauth_v1.OAuthClientAuthorization, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(oauthclientauthorizationsResource, oAuthClientAuthorization), &oauth_v1.OAuthClientAuthorization{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthClientAuthorization), err +} + +// Update takes the representation of a oAuthClientAuthorization and updates it. Returns the server's representation of the oAuthClientAuthorization, and an error, if there is any. +func (c *FakeOAuthClientAuthorizations) Update(oAuthClientAuthorization *oauth_v1.OAuthClientAuthorization) (result *oauth_v1.OAuthClientAuthorization, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(oauthclientauthorizationsResource, oAuthClientAuthorization), &oauth_v1.OAuthClientAuthorization{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthClientAuthorization), err +} + +// Delete takes name of the oAuthClientAuthorization and deletes it. Returns an error if one occurs. +func (c *FakeOAuthClientAuthorizations) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(oauthclientauthorizationsResource, name), &oauth_v1.OAuthClientAuthorization{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeOAuthClientAuthorizations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(oauthclientauthorizationsResource, listOptions) + + _, err := c.Fake.Invokes(action, &oauth_v1.OAuthClientAuthorizationList{}) + return err +} + +// Patch applies the patch and returns the patched oAuthClientAuthorization. +func (c *FakeOAuthClientAuthorizations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *oauth_v1.OAuthClientAuthorization, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(oauthclientauthorizationsResource, name, data, subresources...), &oauth_v1.OAuthClientAuthorization{}) + if obj == nil { + return nil, err + } + return obj.(*oauth_v1.OAuthClientAuthorization), err +} diff --git a/oauth/clientset/versioned/typed/oauth/v1/generated_expansion.go b/oauth/clientset/versioned/typed/oauth/v1/generated_expansion.go new file mode 100644 index 0000000000..da629ce305 --- /dev/null +++ b/oauth/clientset/versioned/typed/oauth/v1/generated_expansion.go @@ -0,0 +1,9 @@ +package v1 + +type OAuthAccessTokenExpansion interface{} + +type OAuthAuthorizeTokenExpansion interface{} + +type OAuthClientExpansion interface{} + +type OAuthClientAuthorizationExpansion interface{} diff --git a/oauth/clientset/versioned/typed/oauth/v1/oauth_client.go b/oauth/clientset/versioned/typed/oauth/v1/oauth_client.go new file mode 100644 index 0000000000..b1b9406f94 --- /dev/null +++ b/oauth/clientset/versioned/typed/oauth/v1/oauth_client.go @@ -0,0 +1,87 @@ +package v1 + +import ( + v1 "github.com/openshift/api/oauth/v1" + "github.com/openshift/client-go/oauth/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type OauthV1Interface interface { + RESTClient() rest.Interface + OAuthAccessTokensGetter + OAuthAuthorizeTokensGetter + OAuthClientsGetter + OAuthClientAuthorizationsGetter +} + +// OauthV1Client is used to interact with features provided by the oauth.openshift.io group. +type OauthV1Client struct { + restClient rest.Interface +} + +func (c *OauthV1Client) OAuthAccessTokens() OAuthAccessTokenInterface { + return newOAuthAccessTokens(c) +} + +func (c *OauthV1Client) OAuthAuthorizeTokens() OAuthAuthorizeTokenInterface { + return newOAuthAuthorizeTokens(c) +} + +func (c *OauthV1Client) OAuthClients() OAuthClientInterface { + return newOAuthClients(c) +} + +func (c *OauthV1Client) OAuthClientAuthorizations() OAuthClientAuthorizationInterface { + return newOAuthClientAuthorizations(c) +} + +// NewForConfig creates a new OauthV1Client for the given config. +func NewForConfig(c *rest.Config) (*OauthV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &OauthV1Client{client}, nil +} + +// NewForConfigOrDie creates a new OauthV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *OauthV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new OauthV1Client for the given RESTClient. +func New(c rest.Interface) *OauthV1Client { + return &OauthV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *OauthV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/oauth/clientset/versioned/typed/oauth/v1/oauthaccesstoken.go b/oauth/clientset/versioned/typed/oauth/v1/oauthaccesstoken.go new file mode 100644 index 0000000000..517d121855 --- /dev/null +++ b/oauth/clientset/versioned/typed/oauth/v1/oauthaccesstoken.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/oauth/v1" + scheme "github.com/openshift/client-go/oauth/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// OAuthAccessTokensGetter has a method to return a OAuthAccessTokenInterface. +// A group's client should implement this interface. +type OAuthAccessTokensGetter interface { + OAuthAccessTokens() OAuthAccessTokenInterface +} + +// OAuthAccessTokenInterface has methods to work with OAuthAccessToken resources. +type OAuthAccessTokenInterface interface { + Create(*v1.OAuthAccessToken) (*v1.OAuthAccessToken, error) + Update(*v1.OAuthAccessToken) (*v1.OAuthAccessToken, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.OAuthAccessToken, error) + List(opts meta_v1.ListOptions) (*v1.OAuthAccessTokenList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.OAuthAccessToken, err error) + OAuthAccessTokenExpansion +} + +// oAuthAccessTokens implements OAuthAccessTokenInterface +type oAuthAccessTokens struct { + client rest.Interface +} + +// newOAuthAccessTokens returns a OAuthAccessTokens +func newOAuthAccessTokens(c *OauthV1Client) *oAuthAccessTokens { + return &oAuthAccessTokens{ + client: c.RESTClient(), + } +} + +// Get takes name of the oAuthAccessToken, and returns the corresponding oAuthAccessToken object, and an error if there is any. +func (c *oAuthAccessTokens) Get(name string, options meta_v1.GetOptions) (result *v1.OAuthAccessToken, err error) { + result = &v1.OAuthAccessToken{} + err = c.client.Get(). + Resource("oauthaccesstokens"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of OAuthAccessTokens that match those selectors. +func (c *oAuthAccessTokens) List(opts meta_v1.ListOptions) (result *v1.OAuthAccessTokenList, err error) { + result = &v1.OAuthAccessTokenList{} + err = c.client.Get(). + Resource("oauthaccesstokens"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested oAuthAccessTokens. +func (c *oAuthAccessTokens) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("oauthaccesstokens"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a oAuthAccessToken and creates it. Returns the server's representation of the oAuthAccessToken, and an error, if there is any. +func (c *oAuthAccessTokens) Create(oAuthAccessToken *v1.OAuthAccessToken) (result *v1.OAuthAccessToken, err error) { + result = &v1.OAuthAccessToken{} + err = c.client.Post(). + Resource("oauthaccesstokens"). + Body(oAuthAccessToken). + Do(). + Into(result) + return +} + +// Update takes the representation of a oAuthAccessToken and updates it. Returns the server's representation of the oAuthAccessToken, and an error, if there is any. +func (c *oAuthAccessTokens) Update(oAuthAccessToken *v1.OAuthAccessToken) (result *v1.OAuthAccessToken, err error) { + result = &v1.OAuthAccessToken{} + err = c.client.Put(). + Resource("oauthaccesstokens"). + Name(oAuthAccessToken.Name). + Body(oAuthAccessToken). + Do(). + Into(result) + return +} + +// Delete takes name of the oAuthAccessToken and deletes it. Returns an error if one occurs. +func (c *oAuthAccessTokens) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("oauthaccesstokens"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *oAuthAccessTokens) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("oauthaccesstokens"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched oAuthAccessToken. +func (c *oAuthAccessTokens) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.OAuthAccessToken, err error) { + result = &v1.OAuthAccessToken{} + err = c.client.Patch(pt). + Resource("oauthaccesstokens"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/oauth/clientset/versioned/typed/oauth/v1/oauthauthorizetoken.go b/oauth/clientset/versioned/typed/oauth/v1/oauthauthorizetoken.go new file mode 100644 index 0000000000..6cff7b1e94 --- /dev/null +++ b/oauth/clientset/versioned/typed/oauth/v1/oauthauthorizetoken.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/oauth/v1" + scheme "github.com/openshift/client-go/oauth/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// OAuthAuthorizeTokensGetter has a method to return a OAuthAuthorizeTokenInterface. +// A group's client should implement this interface. +type OAuthAuthorizeTokensGetter interface { + OAuthAuthorizeTokens() OAuthAuthorizeTokenInterface +} + +// OAuthAuthorizeTokenInterface has methods to work with OAuthAuthorizeToken resources. +type OAuthAuthorizeTokenInterface interface { + Create(*v1.OAuthAuthorizeToken) (*v1.OAuthAuthorizeToken, error) + Update(*v1.OAuthAuthorizeToken) (*v1.OAuthAuthorizeToken, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.OAuthAuthorizeToken, error) + List(opts meta_v1.ListOptions) (*v1.OAuthAuthorizeTokenList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.OAuthAuthorizeToken, err error) + OAuthAuthorizeTokenExpansion +} + +// oAuthAuthorizeTokens implements OAuthAuthorizeTokenInterface +type oAuthAuthorizeTokens struct { + client rest.Interface +} + +// newOAuthAuthorizeTokens returns a OAuthAuthorizeTokens +func newOAuthAuthorizeTokens(c *OauthV1Client) *oAuthAuthorizeTokens { + return &oAuthAuthorizeTokens{ + client: c.RESTClient(), + } +} + +// Get takes name of the oAuthAuthorizeToken, and returns the corresponding oAuthAuthorizeToken object, and an error if there is any. +func (c *oAuthAuthorizeTokens) Get(name string, options meta_v1.GetOptions) (result *v1.OAuthAuthorizeToken, err error) { + result = &v1.OAuthAuthorizeToken{} + err = c.client.Get(). + Resource("oauthauthorizetokens"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of OAuthAuthorizeTokens that match those selectors. +func (c *oAuthAuthorizeTokens) List(opts meta_v1.ListOptions) (result *v1.OAuthAuthorizeTokenList, err error) { + result = &v1.OAuthAuthorizeTokenList{} + err = c.client.Get(). + Resource("oauthauthorizetokens"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested oAuthAuthorizeTokens. +func (c *oAuthAuthorizeTokens) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("oauthauthorizetokens"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a oAuthAuthorizeToken and creates it. Returns the server's representation of the oAuthAuthorizeToken, and an error, if there is any. +func (c *oAuthAuthorizeTokens) Create(oAuthAuthorizeToken *v1.OAuthAuthorizeToken) (result *v1.OAuthAuthorizeToken, err error) { + result = &v1.OAuthAuthorizeToken{} + err = c.client.Post(). + Resource("oauthauthorizetokens"). + Body(oAuthAuthorizeToken). + Do(). + Into(result) + return +} + +// Update takes the representation of a oAuthAuthorizeToken and updates it. Returns the server's representation of the oAuthAuthorizeToken, and an error, if there is any. +func (c *oAuthAuthorizeTokens) Update(oAuthAuthorizeToken *v1.OAuthAuthorizeToken) (result *v1.OAuthAuthorizeToken, err error) { + result = &v1.OAuthAuthorizeToken{} + err = c.client.Put(). + Resource("oauthauthorizetokens"). + Name(oAuthAuthorizeToken.Name). + Body(oAuthAuthorizeToken). + Do(). + Into(result) + return +} + +// Delete takes name of the oAuthAuthorizeToken and deletes it. Returns an error if one occurs. +func (c *oAuthAuthorizeTokens) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("oauthauthorizetokens"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *oAuthAuthorizeTokens) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("oauthauthorizetokens"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched oAuthAuthorizeToken. +func (c *oAuthAuthorizeTokens) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.OAuthAuthorizeToken, err error) { + result = &v1.OAuthAuthorizeToken{} + err = c.client.Patch(pt). + Resource("oauthauthorizetokens"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/oauth/clientset/versioned/typed/oauth/v1/oauthclient.go b/oauth/clientset/versioned/typed/oauth/v1/oauthclient.go new file mode 100644 index 0000000000..d4610c55ac --- /dev/null +++ b/oauth/clientset/versioned/typed/oauth/v1/oauthclient.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/oauth/v1" + scheme "github.com/openshift/client-go/oauth/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// OAuthClientsGetter has a method to return a OAuthClientInterface. +// A group's client should implement this interface. +type OAuthClientsGetter interface { + OAuthClients() OAuthClientInterface +} + +// OAuthClientInterface has methods to work with OAuthClient resources. +type OAuthClientInterface interface { + Create(*v1.OAuthClient) (*v1.OAuthClient, error) + Update(*v1.OAuthClient) (*v1.OAuthClient, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.OAuthClient, error) + List(opts meta_v1.ListOptions) (*v1.OAuthClientList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.OAuthClient, err error) + OAuthClientExpansion +} + +// oAuthClients implements OAuthClientInterface +type oAuthClients struct { + client rest.Interface +} + +// newOAuthClients returns a OAuthClients +func newOAuthClients(c *OauthV1Client) *oAuthClients { + return &oAuthClients{ + client: c.RESTClient(), + } +} + +// Get takes name of the oAuthClient, and returns the corresponding oAuthClient object, and an error if there is any. +func (c *oAuthClients) Get(name string, options meta_v1.GetOptions) (result *v1.OAuthClient, err error) { + result = &v1.OAuthClient{} + err = c.client.Get(). + Resource("oauthclients"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of OAuthClients that match those selectors. +func (c *oAuthClients) List(opts meta_v1.ListOptions) (result *v1.OAuthClientList, err error) { + result = &v1.OAuthClientList{} + err = c.client.Get(). + Resource("oauthclients"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested oAuthClients. +func (c *oAuthClients) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("oauthclients"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a oAuthClient and creates it. Returns the server's representation of the oAuthClient, and an error, if there is any. +func (c *oAuthClients) Create(oAuthClient *v1.OAuthClient) (result *v1.OAuthClient, err error) { + result = &v1.OAuthClient{} + err = c.client.Post(). + Resource("oauthclients"). + Body(oAuthClient). + Do(). + Into(result) + return +} + +// Update takes the representation of a oAuthClient and updates it. Returns the server's representation of the oAuthClient, and an error, if there is any. +func (c *oAuthClients) Update(oAuthClient *v1.OAuthClient) (result *v1.OAuthClient, err error) { + result = &v1.OAuthClient{} + err = c.client.Put(). + Resource("oauthclients"). + Name(oAuthClient.Name). + Body(oAuthClient). + Do(). + Into(result) + return +} + +// Delete takes name of the oAuthClient and deletes it. Returns an error if one occurs. +func (c *oAuthClients) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("oauthclients"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *oAuthClients) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("oauthclients"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched oAuthClient. +func (c *oAuthClients) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.OAuthClient, err error) { + result = &v1.OAuthClient{} + err = c.client.Patch(pt). + Resource("oauthclients"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/oauth/clientset/versioned/typed/oauth/v1/oauthclientauthorization.go b/oauth/clientset/versioned/typed/oauth/v1/oauthclientauthorization.go new file mode 100644 index 0000000000..812a219d00 --- /dev/null +++ b/oauth/clientset/versioned/typed/oauth/v1/oauthclientauthorization.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/oauth/v1" + scheme "github.com/openshift/client-go/oauth/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// OAuthClientAuthorizationsGetter has a method to return a OAuthClientAuthorizationInterface. +// A group's client should implement this interface. +type OAuthClientAuthorizationsGetter interface { + OAuthClientAuthorizations() OAuthClientAuthorizationInterface +} + +// OAuthClientAuthorizationInterface has methods to work with OAuthClientAuthorization resources. +type OAuthClientAuthorizationInterface interface { + Create(*v1.OAuthClientAuthorization) (*v1.OAuthClientAuthorization, error) + Update(*v1.OAuthClientAuthorization) (*v1.OAuthClientAuthorization, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.OAuthClientAuthorization, error) + List(opts meta_v1.ListOptions) (*v1.OAuthClientAuthorizationList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.OAuthClientAuthorization, err error) + OAuthClientAuthorizationExpansion +} + +// oAuthClientAuthorizations implements OAuthClientAuthorizationInterface +type oAuthClientAuthorizations struct { + client rest.Interface +} + +// newOAuthClientAuthorizations returns a OAuthClientAuthorizations +func newOAuthClientAuthorizations(c *OauthV1Client) *oAuthClientAuthorizations { + return &oAuthClientAuthorizations{ + client: c.RESTClient(), + } +} + +// Get takes name of the oAuthClientAuthorization, and returns the corresponding oAuthClientAuthorization object, and an error if there is any. +func (c *oAuthClientAuthorizations) Get(name string, options meta_v1.GetOptions) (result *v1.OAuthClientAuthorization, err error) { + result = &v1.OAuthClientAuthorization{} + err = c.client.Get(). + Resource("oauthclientauthorizations"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of OAuthClientAuthorizations that match those selectors. +func (c *oAuthClientAuthorizations) List(opts meta_v1.ListOptions) (result *v1.OAuthClientAuthorizationList, err error) { + result = &v1.OAuthClientAuthorizationList{} + err = c.client.Get(). + Resource("oauthclientauthorizations"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested oAuthClientAuthorizations. +func (c *oAuthClientAuthorizations) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("oauthclientauthorizations"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a oAuthClientAuthorization and creates it. Returns the server's representation of the oAuthClientAuthorization, and an error, if there is any. +func (c *oAuthClientAuthorizations) Create(oAuthClientAuthorization *v1.OAuthClientAuthorization) (result *v1.OAuthClientAuthorization, err error) { + result = &v1.OAuthClientAuthorization{} + err = c.client.Post(). + Resource("oauthclientauthorizations"). + Body(oAuthClientAuthorization). + Do(). + Into(result) + return +} + +// Update takes the representation of a oAuthClientAuthorization and updates it. Returns the server's representation of the oAuthClientAuthorization, and an error, if there is any. +func (c *oAuthClientAuthorizations) Update(oAuthClientAuthorization *v1.OAuthClientAuthorization) (result *v1.OAuthClientAuthorization, err error) { + result = &v1.OAuthClientAuthorization{} + err = c.client.Put(). + Resource("oauthclientauthorizations"). + Name(oAuthClientAuthorization.Name). + Body(oAuthClientAuthorization). + Do(). + Into(result) + return +} + +// Delete takes name of the oAuthClientAuthorization and deletes it. Returns an error if one occurs. +func (c *oAuthClientAuthorizations) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("oauthclientauthorizations"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *oAuthClientAuthorizations) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("oauthclientauthorizations"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched oAuthClientAuthorization. +func (c *oAuthClientAuthorizations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.OAuthClientAuthorization, err error) { + result = &v1.OAuthClientAuthorization{} + err = c.client.Patch(pt). + Resource("oauthclientauthorizations"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/oauth/informers/externalversions/factory.go b/oauth/informers/externalversions/factory.go new file mode 100644 index 0000000000..a2bc1c9616 --- /dev/null +++ b/oauth/informers/externalversions/factory.go @@ -0,0 +1,102 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + versioned "github.com/openshift/client-go/oauth/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/oauth/informers/externalversions/internalinterfaces" + oauth "github.com/openshift/client-go/oauth/informers/externalversions/oauth" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + reflect "reflect" + sync "sync" + time "time" +) + +type sharedInformerFactory struct { + client versioned.Interface + lock sync.Mutex + defaultResync time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return &sharedInformerFactory{ + client: client, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + } +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + informer = newFunc(f.client, f.defaultResync) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Oauth() oauth.Interface +} + +func (f *sharedInformerFactory) Oauth() oauth.Interface { + return oauth.New(f) +} diff --git a/oauth/informers/externalversions/generic.go b/oauth/informers/externalversions/generic.go new file mode 100644 index 0000000000..71871f7156 --- /dev/null +++ b/oauth/informers/externalversions/generic.go @@ -0,0 +1,51 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + "fmt" + v1 "github.com/openshift/api/oauth/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=Oauth, Version=V1 + case v1.SchemeGroupVersion.WithResource("oauthaccesstokens"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Oauth().V1().OAuthAccessTokens().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("oauthauthorizetokens"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Oauth().V1().OAuthAuthorizeTokens().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("oauthclients"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Oauth().V1().OAuthClients().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("oauthclientauthorizations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Oauth().V1().OAuthClientAuthorizations().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/oauth/informers/externalversions/internalinterfaces/factory_interfaces.go b/oauth/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..fc90428710 --- /dev/null +++ b/oauth/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,18 @@ +// This file was automatically generated by informer-gen + +package internalinterfaces + +import ( + versioned "github.com/openshift/client-go/oauth/clientset/versioned" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} diff --git a/oauth/informers/externalversions/oauth/interface.go b/oauth/informers/externalversions/oauth/interface.go new file mode 100644 index 0000000000..01d492b9b9 --- /dev/null +++ b/oauth/informers/externalversions/oauth/interface.go @@ -0,0 +1,28 @@ +// This file was automatically generated by informer-gen + +package oauth + +import ( + internalinterfaces "github.com/openshift/client-go/oauth/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/oauth/informers/externalversions/oauth/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &group{f} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.SharedInformerFactory) +} diff --git a/oauth/informers/externalversions/oauth/v1/interface.go b/oauth/informers/externalversions/oauth/v1/interface.go new file mode 100644 index 0000000000..1ad17402a7 --- /dev/null +++ b/oauth/informers/externalversions/oauth/v1/interface.go @@ -0,0 +1,48 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + internalinterfaces "github.com/openshift/client-go/oauth/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // OAuthAccessTokens returns a OAuthAccessTokenInformer. + OAuthAccessTokens() OAuthAccessTokenInformer + // OAuthAuthorizeTokens returns a OAuthAuthorizeTokenInformer. + OAuthAuthorizeTokens() OAuthAuthorizeTokenInformer + // OAuthClients returns a OAuthClientInformer. + OAuthClients() OAuthClientInformer + // OAuthClientAuthorizations returns a OAuthClientAuthorizationInformer. + OAuthClientAuthorizations() OAuthClientAuthorizationInformer +} + +type version struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &version{f} +} + +// OAuthAccessTokens returns a OAuthAccessTokenInformer. +func (v *version) OAuthAccessTokens() OAuthAccessTokenInformer { + return &oAuthAccessTokenInformer{factory: v.SharedInformerFactory} +} + +// OAuthAuthorizeTokens returns a OAuthAuthorizeTokenInformer. +func (v *version) OAuthAuthorizeTokens() OAuthAuthorizeTokenInformer { + return &oAuthAuthorizeTokenInformer{factory: v.SharedInformerFactory} +} + +// OAuthClients returns a OAuthClientInformer. +func (v *version) OAuthClients() OAuthClientInformer { + return &oAuthClientInformer{factory: v.SharedInformerFactory} +} + +// OAuthClientAuthorizations returns a OAuthClientAuthorizationInformer. +func (v *version) OAuthClientAuthorizations() OAuthClientAuthorizationInformer { + return &oAuthClientAuthorizationInformer{factory: v.SharedInformerFactory} +} diff --git a/oauth/informers/externalversions/oauth/v1/oauthaccesstoken.go b/oauth/informers/externalversions/oauth/v1/oauthaccesstoken.go new file mode 100644 index 0000000000..88d0523850 --- /dev/null +++ b/oauth/informers/externalversions/oauth/v1/oauthaccesstoken.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + oauth_v1 "github.com/openshift/api/oauth/v1" + versioned "github.com/openshift/client-go/oauth/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/oauth/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/oauth/listers/oauth/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// OAuthAccessTokenInformer provides access to a shared informer and lister for +// OAuthAccessTokens. +type OAuthAccessTokenInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.OAuthAccessTokenLister +} + +type oAuthAccessTokenInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewOAuthAccessTokenInformer constructs a new informer for OAuthAccessToken type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewOAuthAccessTokenInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.OauthV1().OAuthAccessTokens().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.OauthV1().OAuthAccessTokens().Watch(options) + }, + }, + &oauth_v1.OAuthAccessToken{}, + resyncPeriod, + indexers, + ) +} + +func defaultOAuthAccessTokenInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewOAuthAccessTokenInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *oAuthAccessTokenInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&oauth_v1.OAuthAccessToken{}, defaultOAuthAccessTokenInformer) +} + +func (f *oAuthAccessTokenInformer) Lister() v1.OAuthAccessTokenLister { + return v1.NewOAuthAccessTokenLister(f.Informer().GetIndexer()) +} diff --git a/oauth/informers/externalversions/oauth/v1/oauthauthorizetoken.go b/oauth/informers/externalversions/oauth/v1/oauthauthorizetoken.go new file mode 100644 index 0000000000..a8cd146633 --- /dev/null +++ b/oauth/informers/externalversions/oauth/v1/oauthauthorizetoken.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + oauth_v1 "github.com/openshift/api/oauth/v1" + versioned "github.com/openshift/client-go/oauth/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/oauth/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/oauth/listers/oauth/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// OAuthAuthorizeTokenInformer provides access to a shared informer and lister for +// OAuthAuthorizeTokens. +type OAuthAuthorizeTokenInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.OAuthAuthorizeTokenLister +} + +type oAuthAuthorizeTokenInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewOAuthAuthorizeTokenInformer constructs a new informer for OAuthAuthorizeToken type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewOAuthAuthorizeTokenInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.OauthV1().OAuthAuthorizeTokens().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.OauthV1().OAuthAuthorizeTokens().Watch(options) + }, + }, + &oauth_v1.OAuthAuthorizeToken{}, + resyncPeriod, + indexers, + ) +} + +func defaultOAuthAuthorizeTokenInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewOAuthAuthorizeTokenInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *oAuthAuthorizeTokenInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&oauth_v1.OAuthAuthorizeToken{}, defaultOAuthAuthorizeTokenInformer) +} + +func (f *oAuthAuthorizeTokenInformer) Lister() v1.OAuthAuthorizeTokenLister { + return v1.NewOAuthAuthorizeTokenLister(f.Informer().GetIndexer()) +} diff --git a/oauth/informers/externalversions/oauth/v1/oauthclient.go b/oauth/informers/externalversions/oauth/v1/oauthclient.go new file mode 100644 index 0000000000..084128eb32 --- /dev/null +++ b/oauth/informers/externalversions/oauth/v1/oauthclient.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + oauth_v1 "github.com/openshift/api/oauth/v1" + versioned "github.com/openshift/client-go/oauth/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/oauth/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/oauth/listers/oauth/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// OAuthClientInformer provides access to a shared informer and lister for +// OAuthClients. +type OAuthClientInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.OAuthClientLister +} + +type oAuthClientInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewOAuthClientInformer constructs a new informer for OAuthClient type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewOAuthClientInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.OauthV1().OAuthClients().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.OauthV1().OAuthClients().Watch(options) + }, + }, + &oauth_v1.OAuthClient{}, + resyncPeriod, + indexers, + ) +} + +func defaultOAuthClientInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewOAuthClientInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *oAuthClientInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&oauth_v1.OAuthClient{}, defaultOAuthClientInformer) +} + +func (f *oAuthClientInformer) Lister() v1.OAuthClientLister { + return v1.NewOAuthClientLister(f.Informer().GetIndexer()) +} diff --git a/oauth/informers/externalversions/oauth/v1/oauthclientauthorization.go b/oauth/informers/externalversions/oauth/v1/oauthclientauthorization.go new file mode 100644 index 0000000000..40cd1c0443 --- /dev/null +++ b/oauth/informers/externalversions/oauth/v1/oauthclientauthorization.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + oauth_v1 "github.com/openshift/api/oauth/v1" + versioned "github.com/openshift/client-go/oauth/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/oauth/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/oauth/listers/oauth/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// OAuthClientAuthorizationInformer provides access to a shared informer and lister for +// OAuthClientAuthorizations. +type OAuthClientAuthorizationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.OAuthClientAuthorizationLister +} + +type oAuthClientAuthorizationInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewOAuthClientAuthorizationInformer constructs a new informer for OAuthClientAuthorization type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewOAuthClientAuthorizationInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.OauthV1().OAuthClientAuthorizations().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.OauthV1().OAuthClientAuthorizations().Watch(options) + }, + }, + &oauth_v1.OAuthClientAuthorization{}, + resyncPeriod, + indexers, + ) +} + +func defaultOAuthClientAuthorizationInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewOAuthClientAuthorizationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *oAuthClientAuthorizationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&oauth_v1.OAuthClientAuthorization{}, defaultOAuthClientAuthorizationInformer) +} + +func (f *oAuthClientAuthorizationInformer) Lister() v1.OAuthClientAuthorizationLister { + return v1.NewOAuthClientAuthorizationLister(f.Informer().GetIndexer()) +} diff --git a/oauth/listers/oauth/v1/expansion_generated.go b/oauth/listers/oauth/v1/expansion_generated.go new file mode 100644 index 0000000000..6c4d87fb13 --- /dev/null +++ b/oauth/listers/oauth/v1/expansion_generated.go @@ -0,0 +1,19 @@ +// This file was automatically generated by lister-gen + +package v1 + +// OAuthAccessTokenListerExpansion allows custom methods to be added to +// OAuthAccessTokenLister. +type OAuthAccessTokenListerExpansion interface{} + +// OAuthAuthorizeTokenListerExpansion allows custom methods to be added to +// OAuthAuthorizeTokenLister. +type OAuthAuthorizeTokenListerExpansion interface{} + +// OAuthClientListerExpansion allows custom methods to be added to +// OAuthClientLister. +type OAuthClientListerExpansion interface{} + +// OAuthClientAuthorizationListerExpansion allows custom methods to be added to +// OAuthClientAuthorizationLister. +type OAuthClientAuthorizationListerExpansion interface{} diff --git a/oauth/listers/oauth/v1/oauthaccesstoken.go b/oauth/listers/oauth/v1/oauthaccesstoken.go new file mode 100644 index 0000000000..d8cfa17a49 --- /dev/null +++ b/oauth/listers/oauth/v1/oauthaccesstoken.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/oauth/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// OAuthAccessTokenLister helps list OAuthAccessTokens. +type OAuthAccessTokenLister interface { + // List lists all OAuthAccessTokens in the indexer. + List(selector labels.Selector) (ret []*v1.OAuthAccessToken, err error) + // Get retrieves the OAuthAccessToken from the index for a given name. + Get(name string) (*v1.OAuthAccessToken, error) + OAuthAccessTokenListerExpansion +} + +// oAuthAccessTokenLister implements the OAuthAccessTokenLister interface. +type oAuthAccessTokenLister struct { + indexer cache.Indexer +} + +// NewOAuthAccessTokenLister returns a new OAuthAccessTokenLister. +func NewOAuthAccessTokenLister(indexer cache.Indexer) OAuthAccessTokenLister { + return &oAuthAccessTokenLister{indexer: indexer} +} + +// List lists all OAuthAccessTokens in the indexer. +func (s *oAuthAccessTokenLister) List(selector labels.Selector) (ret []*v1.OAuthAccessToken, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.OAuthAccessToken)) + }) + return ret, err +} + +// Get retrieves the OAuthAccessToken from the index for a given name. +func (s *oAuthAccessTokenLister) Get(name string) (*v1.OAuthAccessToken, error) { + key := &v1.OAuthAccessToken{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("oauthaccesstoken"), name) + } + return obj.(*v1.OAuthAccessToken), nil +} diff --git a/oauth/listers/oauth/v1/oauthauthorizetoken.go b/oauth/listers/oauth/v1/oauthauthorizetoken.go new file mode 100644 index 0000000000..d2b0b1ee8f --- /dev/null +++ b/oauth/listers/oauth/v1/oauthauthorizetoken.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/oauth/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// OAuthAuthorizeTokenLister helps list OAuthAuthorizeTokens. +type OAuthAuthorizeTokenLister interface { + // List lists all OAuthAuthorizeTokens in the indexer. + List(selector labels.Selector) (ret []*v1.OAuthAuthorizeToken, err error) + // Get retrieves the OAuthAuthorizeToken from the index for a given name. + Get(name string) (*v1.OAuthAuthorizeToken, error) + OAuthAuthorizeTokenListerExpansion +} + +// oAuthAuthorizeTokenLister implements the OAuthAuthorizeTokenLister interface. +type oAuthAuthorizeTokenLister struct { + indexer cache.Indexer +} + +// NewOAuthAuthorizeTokenLister returns a new OAuthAuthorizeTokenLister. +func NewOAuthAuthorizeTokenLister(indexer cache.Indexer) OAuthAuthorizeTokenLister { + return &oAuthAuthorizeTokenLister{indexer: indexer} +} + +// List lists all OAuthAuthorizeTokens in the indexer. +func (s *oAuthAuthorizeTokenLister) List(selector labels.Selector) (ret []*v1.OAuthAuthorizeToken, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.OAuthAuthorizeToken)) + }) + return ret, err +} + +// Get retrieves the OAuthAuthorizeToken from the index for a given name. +func (s *oAuthAuthorizeTokenLister) Get(name string) (*v1.OAuthAuthorizeToken, error) { + key := &v1.OAuthAuthorizeToken{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("oauthauthorizetoken"), name) + } + return obj.(*v1.OAuthAuthorizeToken), nil +} diff --git a/oauth/listers/oauth/v1/oauthclient.go b/oauth/listers/oauth/v1/oauthclient.go new file mode 100644 index 0000000000..5e4fd9226d --- /dev/null +++ b/oauth/listers/oauth/v1/oauthclient.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/oauth/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// OAuthClientLister helps list OAuthClients. +type OAuthClientLister interface { + // List lists all OAuthClients in the indexer. + List(selector labels.Selector) (ret []*v1.OAuthClient, err error) + // Get retrieves the OAuthClient from the index for a given name. + Get(name string) (*v1.OAuthClient, error) + OAuthClientListerExpansion +} + +// oAuthClientLister implements the OAuthClientLister interface. +type oAuthClientLister struct { + indexer cache.Indexer +} + +// NewOAuthClientLister returns a new OAuthClientLister. +func NewOAuthClientLister(indexer cache.Indexer) OAuthClientLister { + return &oAuthClientLister{indexer: indexer} +} + +// List lists all OAuthClients in the indexer. +func (s *oAuthClientLister) List(selector labels.Selector) (ret []*v1.OAuthClient, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.OAuthClient)) + }) + return ret, err +} + +// Get retrieves the OAuthClient from the index for a given name. +func (s *oAuthClientLister) Get(name string) (*v1.OAuthClient, error) { + key := &v1.OAuthClient{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("oauthclient"), name) + } + return obj.(*v1.OAuthClient), nil +} diff --git a/oauth/listers/oauth/v1/oauthclientauthorization.go b/oauth/listers/oauth/v1/oauthclientauthorization.go new file mode 100644 index 0000000000..2a9147cec2 --- /dev/null +++ b/oauth/listers/oauth/v1/oauthclientauthorization.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/oauth/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// OAuthClientAuthorizationLister helps list OAuthClientAuthorizations. +type OAuthClientAuthorizationLister interface { + // List lists all OAuthClientAuthorizations in the indexer. + List(selector labels.Selector) (ret []*v1.OAuthClientAuthorization, err error) + // Get retrieves the OAuthClientAuthorization from the index for a given name. + Get(name string) (*v1.OAuthClientAuthorization, error) + OAuthClientAuthorizationListerExpansion +} + +// oAuthClientAuthorizationLister implements the OAuthClientAuthorizationLister interface. +type oAuthClientAuthorizationLister struct { + indexer cache.Indexer +} + +// NewOAuthClientAuthorizationLister returns a new OAuthClientAuthorizationLister. +func NewOAuthClientAuthorizationLister(indexer cache.Indexer) OAuthClientAuthorizationLister { + return &oAuthClientAuthorizationLister{indexer: indexer} +} + +// List lists all OAuthClientAuthorizations in the indexer. +func (s *oAuthClientAuthorizationLister) List(selector labels.Selector) (ret []*v1.OAuthClientAuthorization, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.OAuthClientAuthorization)) + }) + return ret, err +} + +// Get retrieves the OAuthClientAuthorization from the index for a given name. +func (s *oAuthClientAuthorizationLister) Get(name string) (*v1.OAuthClientAuthorization, error) { + key := &v1.OAuthClientAuthorization{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("oauthclientauthorization"), name) + } + return obj.(*v1.OAuthClientAuthorization), nil +} diff --git a/project/clientset/versioned/clientset.go b/project/clientset/versioned/clientset.go new file mode 100644 index 0000000000..8bdda581ed --- /dev/null +++ b/project/clientset/versioned/clientset.go @@ -0,0 +1,82 @@ +package versioned + +import ( + glog "github.com/golang/glog" + projectv1 "github.com/openshift/client-go/project/clientset/versioned/typed/project/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + ProjectV1() projectv1.ProjectV1Interface + // Deprecated: please explicitly pick a version if possible. + Project() projectv1.ProjectV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + projectV1 *projectv1.ProjectV1Client +} + +// ProjectV1 retrieves the ProjectV1Client +func (c *Clientset) ProjectV1() projectv1.ProjectV1Interface { + return c.projectV1 +} + +// Deprecated: Project retrieves the default version of ProjectClient. +// Please explicitly pick a version. +func (c *Clientset) Project() projectv1.ProjectV1Interface { + return c.projectV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.projectV1, err = projectv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.projectV1 = projectv1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.projectV1 = projectv1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/project/clientset/versioned/doc.go b/project/clientset/versioned/doc.go new file mode 100644 index 0000000000..72f92921e6 --- /dev/null +++ b/project/clientset/versioned/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated clientset. +package versioned diff --git a/project/clientset/versioned/fake/clientset_generated.go b/project/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..41a4a97754 --- /dev/null +++ b/project/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,55 @@ +package fake + +import ( + clientset "github.com/openshift/client-go/project/clientset/versioned" + projectv1 "github.com/openshift/client-go/project/clientset/versioned/typed/project/v1" + fakeprojectv1 "github.com/openshift/client-go/project/clientset/versioned/typed/project/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := testing.Fake{} + fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) + fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// ProjectV1 retrieves the ProjectV1Client +func (c *Clientset) ProjectV1() projectv1.ProjectV1Interface { + return &fakeprojectv1.FakeProjectV1{Fake: &c.Fake} +} + +// Project retrieves the ProjectV1Client +func (c *Clientset) Project() projectv1.ProjectV1Interface { + return &fakeprojectv1.FakeProjectV1{Fake: &c.Fake} +} diff --git a/project/clientset/versioned/fake/doc.go b/project/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..760aaa8253 --- /dev/null +++ b/project/clientset/versioned/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated fake clientset. +package fake diff --git a/project/clientset/versioned/fake/register.go b/project/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..25fd4f4721 --- /dev/null +++ b/project/clientset/versioned/fake/register.go @@ -0,0 +1,37 @@ +package fake + +import ( + projectv1 "github.com/openshift/api/project/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + projectv1.AddToScheme(scheme) + +} diff --git a/project/clientset/versioned/scheme/doc.go b/project/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..d1c53d03b2 --- /dev/null +++ b/project/clientset/versioned/scheme/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/project/clientset/versioned/scheme/register.go b/project/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..a44b1e42c3 --- /dev/null +++ b/project/clientset/versioned/scheme/register.go @@ -0,0 +1,37 @@ +package scheme + +import ( + projectv1 "github.com/openshift/api/project/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + projectv1.AddToScheme(scheme) + +} diff --git a/project/clientset/versioned/typed/project/v1/doc.go b/project/clientset/versioned/typed/project/v1/doc.go new file mode 100644 index 0000000000..0e93c2c5e7 --- /dev/null +++ b/project/clientset/versioned/typed/project/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated typed clients. +package v1 diff --git a/project/clientset/versioned/typed/project/v1/fake/doc.go b/project/clientset/versioned/typed/project/v1/fake/doc.go new file mode 100644 index 0000000000..e3bbd12a2b --- /dev/null +++ b/project/clientset/versioned/typed/project/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// Package fake has the automatically generated clients. +package fake diff --git a/project/clientset/versioned/typed/project/v1/fake/fake_project.go b/project/clientset/versioned/typed/project/v1/fake/fake_project.go new file mode 100644 index 0000000000..36f6e09796 --- /dev/null +++ b/project/clientset/versioned/typed/project/v1/fake/fake_project.go @@ -0,0 +1,113 @@ +package fake + +import ( + project_v1 "github.com/openshift/api/project/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeProjects implements ProjectInterface +type FakeProjects struct { + Fake *FakeProjectV1 +} + +var projectsResource = schema.GroupVersionResource{Group: "project.openshift.io", Version: "v1", Resource: "projects"} + +var projectsKind = schema.GroupVersionKind{Group: "project.openshift.io", Version: "v1", Kind: "Project"} + +// Get takes name of the project, and returns the corresponding project object, and an error if there is any. +func (c *FakeProjects) Get(name string, options v1.GetOptions) (result *project_v1.Project, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(projectsResource, name), &project_v1.Project{}) + if obj == nil { + return nil, err + } + return obj.(*project_v1.Project), err +} + +// List takes label and field selectors, and returns the list of Projects that match those selectors. +func (c *FakeProjects) List(opts v1.ListOptions) (result *project_v1.ProjectList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(projectsResource, projectsKind, opts), &project_v1.ProjectList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &project_v1.ProjectList{} + for _, item := range obj.(*project_v1.ProjectList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested projects. +func (c *FakeProjects) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(projectsResource, opts)) +} + +// Create takes the representation of a project and creates it. Returns the server's representation of the project, and an error, if there is any. +func (c *FakeProjects) Create(project *project_v1.Project) (result *project_v1.Project, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(projectsResource, project), &project_v1.Project{}) + if obj == nil { + return nil, err + } + return obj.(*project_v1.Project), err +} + +// Update takes the representation of a project and updates it. Returns the server's representation of the project, and an error, if there is any. +func (c *FakeProjects) Update(project *project_v1.Project) (result *project_v1.Project, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(projectsResource, project), &project_v1.Project{}) + if obj == nil { + return nil, err + } + return obj.(*project_v1.Project), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeProjects) UpdateStatus(project *project_v1.Project) (*project_v1.Project, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(projectsResource, "status", project), &project_v1.Project{}) + if obj == nil { + return nil, err + } + return obj.(*project_v1.Project), err +} + +// Delete takes name of the project and deletes it. Returns an error if one occurs. +func (c *FakeProjects) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(projectsResource, name), &project_v1.Project{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeProjects) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(projectsResource, listOptions) + + _, err := c.Fake.Invokes(action, &project_v1.ProjectList{}) + return err +} + +// Patch applies the patch and returns the patched project. +func (c *FakeProjects) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *project_v1.Project, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(projectsResource, name, data, subresources...), &project_v1.Project{}) + if obj == nil { + return nil, err + } + return obj.(*project_v1.Project), err +} diff --git a/project/clientset/versioned/typed/project/v1/fake/fake_project_client.go b/project/clientset/versioned/typed/project/v1/fake/fake_project_client.go new file mode 100644 index 0000000000..336f22a259 --- /dev/null +++ b/project/clientset/versioned/typed/project/v1/fake/fake_project_client.go @@ -0,0 +1,26 @@ +package fake + +import ( + v1 "github.com/openshift/client-go/project/clientset/versioned/typed/project/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeProjectV1 struct { + *testing.Fake +} + +func (c *FakeProjectV1) Projects() v1.ProjectInterface { + return &FakeProjects{c} +} + +func (c *FakeProjectV1) ProjectRequests() v1.ProjectRequestInterface { + return &FakeProjectRequests{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeProjectV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/project/clientset/versioned/typed/project/v1/fake/fake_projectrequest.go b/project/clientset/versioned/typed/project/v1/fake/fake_projectrequest.go new file mode 100644 index 0000000000..7df6dd4bf7 --- /dev/null +++ b/project/clientset/versioned/typed/project/v1/fake/fake_projectrequest.go @@ -0,0 +1,26 @@ +package fake + +import ( + v1 "github.com/openshift/api/project/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeProjectRequests implements ProjectRequestInterface +type FakeProjectRequests struct { + Fake *FakeProjectV1 +} + +var projectrequestsResource = schema.GroupVersionResource{Group: "project.openshift.io", Version: "v1", Resource: "projectrequests"} + +var projectrequestsKind = schema.GroupVersionKind{Group: "project.openshift.io", Version: "v1", Kind: "ProjectRequest"} + +// Create takes the representation of a projectRequest and creates it. Returns the server's representation of the project, and an error, if there is any. +func (c *FakeProjectRequests) Create(projectRequest *v1.ProjectRequest) (result *v1.Project, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(projectrequestsResource, projectRequest), &v1.Project{}) + if obj == nil { + return nil, err + } + return obj.(*v1.Project), err +} diff --git a/project/clientset/versioned/typed/project/v1/generated_expansion.go b/project/clientset/versioned/typed/project/v1/generated_expansion.go new file mode 100644 index 0000000000..4be85a4b5f --- /dev/null +++ b/project/clientset/versioned/typed/project/v1/generated_expansion.go @@ -0,0 +1,5 @@ +package v1 + +type ProjectExpansion interface{} + +type ProjectRequestExpansion interface{} diff --git a/project/clientset/versioned/typed/project/v1/project.go b/project/clientset/versioned/typed/project/v1/project.go new file mode 100644 index 0000000000..affd9973b2 --- /dev/null +++ b/project/clientset/versioned/typed/project/v1/project.go @@ -0,0 +1,145 @@ +package v1 + +import ( + v1 "github.com/openshift/api/project/v1" + scheme "github.com/openshift/client-go/project/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ProjectsGetter has a method to return a ProjectInterface. +// A group's client should implement this interface. +type ProjectsGetter interface { + Projects() ProjectInterface +} + +// ProjectInterface has methods to work with Project resources. +type ProjectInterface interface { + Create(*v1.Project) (*v1.Project, error) + Update(*v1.Project) (*v1.Project, error) + UpdateStatus(*v1.Project) (*v1.Project, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.Project, error) + List(opts meta_v1.ListOptions) (*v1.ProjectList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Project, err error) + ProjectExpansion +} + +// projects implements ProjectInterface +type projects struct { + client rest.Interface +} + +// newProjects returns a Projects +func newProjects(c *ProjectV1Client) *projects { + return &projects{ + client: c.RESTClient(), + } +} + +// Get takes name of the project, and returns the corresponding project object, and an error if there is any. +func (c *projects) Get(name string, options meta_v1.GetOptions) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Get(). + Resource("projects"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Projects that match those selectors. +func (c *projects) List(opts meta_v1.ListOptions) (result *v1.ProjectList, err error) { + result = &v1.ProjectList{} + err = c.client.Get(). + Resource("projects"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested projects. +func (c *projects) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("projects"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a project and creates it. Returns the server's representation of the project, and an error, if there is any. +func (c *projects) Create(project *v1.Project) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Post(). + Resource("projects"). + Body(project). + Do(). + Into(result) + return +} + +// Update takes the representation of a project and updates it. Returns the server's representation of the project, and an error, if there is any. +func (c *projects) Update(project *v1.Project) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Put(). + Resource("projects"). + Name(project.Name). + Body(project). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *projects) UpdateStatus(project *v1.Project) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Put(). + Resource("projects"). + Name(project.Name). + SubResource("status"). + Body(project). + Do(). + Into(result) + return +} + +// Delete takes name of the project and deletes it. Returns an error if one occurs. +func (c *projects) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("projects"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *projects) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("projects"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched project. +func (c *projects) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Patch(pt). + Resource("projects"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/project/clientset/versioned/typed/project/v1/project_client.go b/project/clientset/versioned/typed/project/v1/project_client.go new file mode 100644 index 0000000000..db59dcf8f9 --- /dev/null +++ b/project/clientset/versioned/typed/project/v1/project_client.go @@ -0,0 +1,77 @@ +package v1 + +import ( + v1 "github.com/openshift/api/project/v1" + "github.com/openshift/client-go/project/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type ProjectV1Interface interface { + RESTClient() rest.Interface + ProjectsGetter + ProjectRequestsGetter +} + +// ProjectV1Client is used to interact with features provided by the project.openshift.io group. +type ProjectV1Client struct { + restClient rest.Interface +} + +func (c *ProjectV1Client) Projects() ProjectInterface { + return newProjects(c) +} + +func (c *ProjectV1Client) ProjectRequests() ProjectRequestInterface { + return newProjectRequests(c) +} + +// NewForConfig creates a new ProjectV1Client for the given config. +func NewForConfig(c *rest.Config) (*ProjectV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &ProjectV1Client{client}, nil +} + +// NewForConfigOrDie creates a new ProjectV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *ProjectV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ProjectV1Client for the given RESTClient. +func New(c rest.Interface) *ProjectV1Client { + return &ProjectV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *ProjectV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/project/clientset/versioned/typed/project/v1/projectrequest.go b/project/clientset/versioned/typed/project/v1/projectrequest.go new file mode 100644 index 0000000000..e37f471328 --- /dev/null +++ b/project/clientset/versioned/typed/project/v1/projectrequest.go @@ -0,0 +1,42 @@ +package v1 + +import ( + v1 "github.com/openshift/api/project/v1" + rest "k8s.io/client-go/rest" +) + +// ProjectRequestsGetter has a method to return a ProjectRequestInterface. +// A group's client should implement this interface. +type ProjectRequestsGetter interface { + ProjectRequests() ProjectRequestInterface +} + +// ProjectRequestInterface has methods to work with ProjectRequest resources. +type ProjectRequestInterface interface { + Create(*v1.ProjectRequest) (*v1.Project, error) + + ProjectRequestExpansion +} + +// projectRequests implements ProjectRequestInterface +type projectRequests struct { + client rest.Interface +} + +// newProjectRequests returns a ProjectRequests +func newProjectRequests(c *ProjectV1Client) *projectRequests { + return &projectRequests{ + client: c.RESTClient(), + } +} + +// Create takes the representation of a projectRequest and creates it. Returns the server's representation of the project, and an error, if there is any. +func (c *projectRequests) Create(projectRequest *v1.ProjectRequest) (result *v1.Project, err error) { + result = &v1.Project{} + err = c.client.Post(). + Resource("projectrequests"). + Body(projectRequest). + Do(). + Into(result) + return +} diff --git a/project/informers/externalversions/factory.go b/project/informers/externalversions/factory.go new file mode 100644 index 0000000000..e78ed9a100 --- /dev/null +++ b/project/informers/externalversions/factory.go @@ -0,0 +1,102 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + versioned "github.com/openshift/client-go/project/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/project/informers/externalversions/internalinterfaces" + project "github.com/openshift/client-go/project/informers/externalversions/project" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + reflect "reflect" + sync "sync" + time "time" +) + +type sharedInformerFactory struct { + client versioned.Interface + lock sync.Mutex + defaultResync time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return &sharedInformerFactory{ + client: client, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + } +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + informer = newFunc(f.client, f.defaultResync) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Project() project.Interface +} + +func (f *sharedInformerFactory) Project() project.Interface { + return project.New(f) +} diff --git a/project/informers/externalversions/generic.go b/project/informers/externalversions/generic.go new file mode 100644 index 0000000000..9d402df8f3 --- /dev/null +++ b/project/informers/externalversions/generic.go @@ -0,0 +1,45 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + "fmt" + v1 "github.com/openshift/api/project/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=Project, Version=V1 + case v1.SchemeGroupVersion.WithResource("projects"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Project().V1().Projects().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/project/informers/externalversions/internalinterfaces/factory_interfaces.go b/project/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..9c11b47e1d --- /dev/null +++ b/project/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,18 @@ +// This file was automatically generated by informer-gen + +package internalinterfaces + +import ( + versioned "github.com/openshift/client-go/project/clientset/versioned" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} diff --git a/project/informers/externalversions/project/interface.go b/project/informers/externalversions/project/interface.go new file mode 100644 index 0000000000..aa0fb5e180 --- /dev/null +++ b/project/informers/externalversions/project/interface.go @@ -0,0 +1,28 @@ +// This file was automatically generated by informer-gen + +package project + +import ( + internalinterfaces "github.com/openshift/client-go/project/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/project/informers/externalversions/project/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &group{f} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.SharedInformerFactory) +} diff --git a/project/informers/externalversions/project/v1/interface.go b/project/informers/externalversions/project/v1/interface.go new file mode 100644 index 0000000000..7ae9acfd89 --- /dev/null +++ b/project/informers/externalversions/project/v1/interface.go @@ -0,0 +1,27 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + internalinterfaces "github.com/openshift/client-go/project/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Projects returns a ProjectInformer. + Projects() ProjectInformer +} + +type version struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &version{f} +} + +// Projects returns a ProjectInformer. +func (v *version) Projects() ProjectInformer { + return &projectInformer{factory: v.SharedInformerFactory} +} diff --git a/project/informers/externalversions/project/v1/project.go b/project/informers/externalversions/project/v1/project.go new file mode 100644 index 0000000000..1a30c12051 --- /dev/null +++ b/project/informers/externalversions/project/v1/project.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + project_v1 "github.com/openshift/api/project/v1" + versioned "github.com/openshift/client-go/project/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/project/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/project/listers/project/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// ProjectInformer provides access to a shared informer and lister for +// Projects. +type ProjectInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ProjectLister +} + +type projectInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewProjectInformer constructs a new informer for Project type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewProjectInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.ProjectV1().Projects().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.ProjectV1().Projects().Watch(options) + }, + }, + &project_v1.Project{}, + resyncPeriod, + indexers, + ) +} + +func defaultProjectInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewProjectInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *projectInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&project_v1.Project{}, defaultProjectInformer) +} + +func (f *projectInformer) Lister() v1.ProjectLister { + return v1.NewProjectLister(f.Informer().GetIndexer()) +} diff --git a/project/listers/project/v1/expansion_generated.go b/project/listers/project/v1/expansion_generated.go new file mode 100644 index 0000000000..437f407707 --- /dev/null +++ b/project/listers/project/v1/expansion_generated.go @@ -0,0 +1,7 @@ +// This file was automatically generated by lister-gen + +package v1 + +// ProjectListerExpansion allows custom methods to be added to +// ProjectLister. +type ProjectListerExpansion interface{} diff --git a/project/listers/project/v1/project.go b/project/listers/project/v1/project.go new file mode 100644 index 0000000000..0d7672e94a --- /dev/null +++ b/project/listers/project/v1/project.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/project/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ProjectLister helps list Projects. +type ProjectLister interface { + // List lists all Projects in the indexer. + List(selector labels.Selector) (ret []*v1.Project, err error) + // Get retrieves the Project from the index for a given name. + Get(name string) (*v1.Project, error) + ProjectListerExpansion +} + +// projectLister implements the ProjectLister interface. +type projectLister struct { + indexer cache.Indexer +} + +// NewProjectLister returns a new ProjectLister. +func NewProjectLister(indexer cache.Indexer) ProjectLister { + return &projectLister{indexer: indexer} +} + +// List lists all Projects in the indexer. +func (s *projectLister) List(selector labels.Selector) (ret []*v1.Project, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Project)) + }) + return ret, err +} + +// Get retrieves the Project from the index for a given name. +func (s *projectLister) Get(name string) (*v1.Project, error) { + key := &v1.Project{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("project"), name) + } + return obj.(*v1.Project), nil +} diff --git a/quota/clientset/versioned/clientset.go b/quota/clientset/versioned/clientset.go new file mode 100644 index 0000000000..6fc9582a91 --- /dev/null +++ b/quota/clientset/versioned/clientset.go @@ -0,0 +1,82 @@ +package versioned + +import ( + glog "github.com/golang/glog" + quotav1 "github.com/openshift/client-go/quota/clientset/versioned/typed/quota/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + QuotaV1() quotav1.QuotaV1Interface + // Deprecated: please explicitly pick a version if possible. + Quota() quotav1.QuotaV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + quotaV1 *quotav1.QuotaV1Client +} + +// QuotaV1 retrieves the QuotaV1Client +func (c *Clientset) QuotaV1() quotav1.QuotaV1Interface { + return c.quotaV1 +} + +// Deprecated: Quota retrieves the default version of QuotaClient. +// Please explicitly pick a version. +func (c *Clientset) Quota() quotav1.QuotaV1Interface { + return c.quotaV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.quotaV1, err = quotav1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.quotaV1 = quotav1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.quotaV1 = quotav1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/quota/clientset/versioned/doc.go b/quota/clientset/versioned/doc.go new file mode 100644 index 0000000000..72f92921e6 --- /dev/null +++ b/quota/clientset/versioned/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated clientset. +package versioned diff --git a/quota/clientset/versioned/fake/clientset_generated.go b/quota/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..b033832ac8 --- /dev/null +++ b/quota/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,55 @@ +package fake + +import ( + clientset "github.com/openshift/client-go/quota/clientset/versioned" + quotav1 "github.com/openshift/client-go/quota/clientset/versioned/typed/quota/v1" + fakequotav1 "github.com/openshift/client-go/quota/clientset/versioned/typed/quota/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := testing.Fake{} + fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) + fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// QuotaV1 retrieves the QuotaV1Client +func (c *Clientset) QuotaV1() quotav1.QuotaV1Interface { + return &fakequotav1.FakeQuotaV1{Fake: &c.Fake} +} + +// Quota retrieves the QuotaV1Client +func (c *Clientset) Quota() quotav1.QuotaV1Interface { + return &fakequotav1.FakeQuotaV1{Fake: &c.Fake} +} diff --git a/quota/clientset/versioned/fake/doc.go b/quota/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..760aaa8253 --- /dev/null +++ b/quota/clientset/versioned/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated fake clientset. +package fake diff --git a/quota/clientset/versioned/fake/register.go b/quota/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..29caebbf1d --- /dev/null +++ b/quota/clientset/versioned/fake/register.go @@ -0,0 +1,37 @@ +package fake + +import ( + quotav1 "github.com/openshift/api/quota/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + quotav1.AddToScheme(scheme) + +} diff --git a/quota/clientset/versioned/scheme/doc.go b/quota/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..d1c53d03b2 --- /dev/null +++ b/quota/clientset/versioned/scheme/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/quota/clientset/versioned/scheme/register.go b/quota/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..8a9a2890a6 --- /dev/null +++ b/quota/clientset/versioned/scheme/register.go @@ -0,0 +1,37 @@ +package scheme + +import ( + quotav1 "github.com/openshift/api/quota/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + quotav1.AddToScheme(scheme) + +} diff --git a/quota/clientset/versioned/typed/quota/v1/appliedclusterresourcequota.go b/quota/clientset/versioned/typed/quota/v1/appliedclusterresourcequota.go new file mode 100644 index 0000000000..1a7019715c --- /dev/null +++ b/quota/clientset/versioned/typed/quota/v1/appliedclusterresourcequota.go @@ -0,0 +1,60 @@ +package v1 + +import ( + quota_v1 "github.com/openshift/api/quota/v1" + scheme "github.com/openshift/client-go/quota/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// AppliedClusterResourceQuotasGetter has a method to return a AppliedClusterResourceQuotaInterface. +// A group's client should implement this interface. +type AppliedClusterResourceQuotasGetter interface { + AppliedClusterResourceQuotas(namespace string) AppliedClusterResourceQuotaInterface +} + +// AppliedClusterResourceQuotaInterface has methods to work with AppliedClusterResourceQuota resources. +type AppliedClusterResourceQuotaInterface interface { + Get(name string, options v1.GetOptions) (*quota_v1.AppliedClusterResourceQuota, error) + List(opts v1.ListOptions) (*quota_v1.AppliedClusterResourceQuotaList, error) + AppliedClusterResourceQuotaExpansion +} + +// appliedClusterResourceQuotas implements AppliedClusterResourceQuotaInterface +type appliedClusterResourceQuotas struct { + client rest.Interface + ns string +} + +// newAppliedClusterResourceQuotas returns a AppliedClusterResourceQuotas +func newAppliedClusterResourceQuotas(c *QuotaV1Client, namespace string) *appliedClusterResourceQuotas { + return &appliedClusterResourceQuotas{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the appliedClusterResourceQuota, and returns the corresponding appliedClusterResourceQuota object, and an error if there is any. +func (c *appliedClusterResourceQuotas) Get(name string, options v1.GetOptions) (result *quota_v1.AppliedClusterResourceQuota, err error) { + result = "a_v1.AppliedClusterResourceQuota{} + err = c.client.Get(). + Namespace(c.ns). + Resource("appliedclusterresourcequotas"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of AppliedClusterResourceQuotas that match those selectors. +func (c *appliedClusterResourceQuotas) List(opts v1.ListOptions) (result *quota_v1.AppliedClusterResourceQuotaList, err error) { + result = "a_v1.AppliedClusterResourceQuotaList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("appliedclusterresourcequotas"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} diff --git a/quota/clientset/versioned/typed/quota/v1/clusterresourcequota.go b/quota/clientset/versioned/typed/quota/v1/clusterresourcequota.go new file mode 100644 index 0000000000..fb5953fc78 --- /dev/null +++ b/quota/clientset/versioned/typed/quota/v1/clusterresourcequota.go @@ -0,0 +1,145 @@ +package v1 + +import ( + v1 "github.com/openshift/api/quota/v1" + scheme "github.com/openshift/client-go/quota/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ClusterResourceQuotasGetter has a method to return a ClusterResourceQuotaInterface. +// A group's client should implement this interface. +type ClusterResourceQuotasGetter interface { + ClusterResourceQuotas() ClusterResourceQuotaInterface +} + +// ClusterResourceQuotaInterface has methods to work with ClusterResourceQuota resources. +type ClusterResourceQuotaInterface interface { + Create(*v1.ClusterResourceQuota) (*v1.ClusterResourceQuota, error) + Update(*v1.ClusterResourceQuota) (*v1.ClusterResourceQuota, error) + UpdateStatus(*v1.ClusterResourceQuota) (*v1.ClusterResourceQuota, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.ClusterResourceQuota, error) + List(opts meta_v1.ListOptions) (*v1.ClusterResourceQuotaList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterResourceQuota, err error) + ClusterResourceQuotaExpansion +} + +// clusterResourceQuotas implements ClusterResourceQuotaInterface +type clusterResourceQuotas struct { + client rest.Interface +} + +// newClusterResourceQuotas returns a ClusterResourceQuotas +func newClusterResourceQuotas(c *QuotaV1Client) *clusterResourceQuotas { + return &clusterResourceQuotas{ + client: c.RESTClient(), + } +} + +// Get takes name of the clusterResourceQuota, and returns the corresponding clusterResourceQuota object, and an error if there is any. +func (c *clusterResourceQuotas) Get(name string, options meta_v1.GetOptions) (result *v1.ClusterResourceQuota, err error) { + result = &v1.ClusterResourceQuota{} + err = c.client.Get(). + Resource("clusterresourcequotas"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterResourceQuotas that match those selectors. +func (c *clusterResourceQuotas) List(opts meta_v1.ListOptions) (result *v1.ClusterResourceQuotaList, err error) { + result = &v1.ClusterResourceQuotaList{} + err = c.client.Get(). + Resource("clusterresourcequotas"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterResourceQuotas. +func (c *clusterResourceQuotas) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("clusterresourcequotas"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a clusterResourceQuota and creates it. Returns the server's representation of the clusterResourceQuota, and an error, if there is any. +func (c *clusterResourceQuotas) Create(clusterResourceQuota *v1.ClusterResourceQuota) (result *v1.ClusterResourceQuota, err error) { + result = &v1.ClusterResourceQuota{} + err = c.client.Post(). + Resource("clusterresourcequotas"). + Body(clusterResourceQuota). + Do(). + Into(result) + return +} + +// Update takes the representation of a clusterResourceQuota and updates it. Returns the server's representation of the clusterResourceQuota, and an error, if there is any. +func (c *clusterResourceQuotas) Update(clusterResourceQuota *v1.ClusterResourceQuota) (result *v1.ClusterResourceQuota, err error) { + result = &v1.ClusterResourceQuota{} + err = c.client.Put(). + Resource("clusterresourcequotas"). + Name(clusterResourceQuota.Name). + Body(clusterResourceQuota). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *clusterResourceQuotas) UpdateStatus(clusterResourceQuota *v1.ClusterResourceQuota) (result *v1.ClusterResourceQuota, err error) { + result = &v1.ClusterResourceQuota{} + err = c.client.Put(). + Resource("clusterresourcequotas"). + Name(clusterResourceQuota.Name). + SubResource("status"). + Body(clusterResourceQuota). + Do(). + Into(result) + return +} + +// Delete takes name of the clusterResourceQuota and deletes it. Returns an error if one occurs. +func (c *clusterResourceQuotas) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clusterresourcequotas"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterResourceQuotas) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("clusterresourcequotas"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched clusterResourceQuota. +func (c *clusterResourceQuotas) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ClusterResourceQuota, err error) { + result = &v1.ClusterResourceQuota{} + err = c.client.Patch(pt). + Resource("clusterresourcequotas"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/quota/clientset/versioned/typed/quota/v1/doc.go b/quota/clientset/versioned/typed/quota/v1/doc.go new file mode 100644 index 0000000000..0e93c2c5e7 --- /dev/null +++ b/quota/clientset/versioned/typed/quota/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated typed clients. +package v1 diff --git a/quota/clientset/versioned/typed/quota/v1/fake/doc.go b/quota/clientset/versioned/typed/quota/v1/fake/doc.go new file mode 100644 index 0000000000..e3bbd12a2b --- /dev/null +++ b/quota/clientset/versioned/typed/quota/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// Package fake has the automatically generated clients. +package fake diff --git a/quota/clientset/versioned/typed/quota/v1/fake/fake_appliedclusterresourcequota.go b/quota/clientset/versioned/typed/quota/v1/fake/fake_appliedclusterresourcequota.go new file mode 100644 index 0000000000..db48901a93 --- /dev/null +++ b/quota/clientset/versioned/typed/quota/v1/fake/fake_appliedclusterresourcequota.go @@ -0,0 +1,52 @@ +package fake + +import ( + quota_v1 "github.com/openshift/api/quota/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeAppliedClusterResourceQuotas implements AppliedClusterResourceQuotaInterface +type FakeAppliedClusterResourceQuotas struct { + Fake *FakeQuotaV1 + ns string +} + +var appliedclusterresourcequotasResource = schema.GroupVersionResource{Group: "quota.openshift.io", Version: "v1", Resource: "appliedclusterresourcequotas"} + +var appliedclusterresourcequotasKind = schema.GroupVersionKind{Group: "quota.openshift.io", Version: "v1", Kind: "AppliedClusterResourceQuota"} + +// Get takes name of the appliedClusterResourceQuota, and returns the corresponding appliedClusterResourceQuota object, and an error if there is any. +func (c *FakeAppliedClusterResourceQuotas) Get(name string, options v1.GetOptions) (result *quota_v1.AppliedClusterResourceQuota, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(appliedclusterresourcequotasResource, c.ns, name), "a_v1.AppliedClusterResourceQuota{}) + + if obj == nil { + return nil, err + } + return obj.(*quota_v1.AppliedClusterResourceQuota), err +} + +// List takes label and field selectors, and returns the list of AppliedClusterResourceQuotas that match those selectors. +func (c *FakeAppliedClusterResourceQuotas) List(opts v1.ListOptions) (result *quota_v1.AppliedClusterResourceQuotaList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(appliedclusterresourcequotasResource, appliedclusterresourcequotasKind, c.ns, opts), "a_v1.AppliedClusterResourceQuotaList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := "a_v1.AppliedClusterResourceQuotaList{} + for _, item := range obj.(*quota_v1.AppliedClusterResourceQuotaList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} diff --git a/quota/clientset/versioned/typed/quota/v1/fake/fake_clusterresourcequota.go b/quota/clientset/versioned/typed/quota/v1/fake/fake_clusterresourcequota.go new file mode 100644 index 0000000000..387943eca9 --- /dev/null +++ b/quota/clientset/versioned/typed/quota/v1/fake/fake_clusterresourcequota.go @@ -0,0 +1,113 @@ +package fake + +import ( + quota_v1 "github.com/openshift/api/quota/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeClusterResourceQuotas implements ClusterResourceQuotaInterface +type FakeClusterResourceQuotas struct { + Fake *FakeQuotaV1 +} + +var clusterresourcequotasResource = schema.GroupVersionResource{Group: "quota.openshift.io", Version: "v1", Resource: "clusterresourcequotas"} + +var clusterresourcequotasKind = schema.GroupVersionKind{Group: "quota.openshift.io", Version: "v1", Kind: "ClusterResourceQuota"} + +// Get takes name of the clusterResourceQuota, and returns the corresponding clusterResourceQuota object, and an error if there is any. +func (c *FakeClusterResourceQuotas) Get(name string, options v1.GetOptions) (result *quota_v1.ClusterResourceQuota, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clusterresourcequotasResource, name), "a_v1.ClusterResourceQuota{}) + if obj == nil { + return nil, err + } + return obj.(*quota_v1.ClusterResourceQuota), err +} + +// List takes label and field selectors, and returns the list of ClusterResourceQuotas that match those selectors. +func (c *FakeClusterResourceQuotas) List(opts v1.ListOptions) (result *quota_v1.ClusterResourceQuotaList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clusterresourcequotasResource, clusterresourcequotasKind, opts), "a_v1.ClusterResourceQuotaList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := "a_v1.ClusterResourceQuotaList{} + for _, item := range obj.(*quota_v1.ClusterResourceQuotaList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterResourceQuotas. +func (c *FakeClusterResourceQuotas) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clusterresourcequotasResource, opts)) +} + +// Create takes the representation of a clusterResourceQuota and creates it. Returns the server's representation of the clusterResourceQuota, and an error, if there is any. +func (c *FakeClusterResourceQuotas) Create(clusterResourceQuota *quota_v1.ClusterResourceQuota) (result *quota_v1.ClusterResourceQuota, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clusterresourcequotasResource, clusterResourceQuota), "a_v1.ClusterResourceQuota{}) + if obj == nil { + return nil, err + } + return obj.(*quota_v1.ClusterResourceQuota), err +} + +// Update takes the representation of a clusterResourceQuota and updates it. Returns the server's representation of the clusterResourceQuota, and an error, if there is any. +func (c *FakeClusterResourceQuotas) Update(clusterResourceQuota *quota_v1.ClusterResourceQuota) (result *quota_v1.ClusterResourceQuota, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clusterresourcequotasResource, clusterResourceQuota), "a_v1.ClusterResourceQuota{}) + if obj == nil { + return nil, err + } + return obj.(*quota_v1.ClusterResourceQuota), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeClusterResourceQuotas) UpdateStatus(clusterResourceQuota *quota_v1.ClusterResourceQuota) (*quota_v1.ClusterResourceQuota, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(clusterresourcequotasResource, "status", clusterResourceQuota), "a_v1.ClusterResourceQuota{}) + if obj == nil { + return nil, err + } + return obj.(*quota_v1.ClusterResourceQuota), err +} + +// Delete takes name of the clusterResourceQuota and deletes it. Returns an error if one occurs. +func (c *FakeClusterResourceQuotas) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(clusterresourcequotasResource, name), "a_v1.ClusterResourceQuota{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterResourceQuotas) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clusterresourcequotasResource, listOptions) + + _, err := c.Fake.Invokes(action, "a_v1.ClusterResourceQuotaList{}) + return err +} + +// Patch applies the patch and returns the patched clusterResourceQuota. +func (c *FakeClusterResourceQuotas) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *quota_v1.ClusterResourceQuota, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusterresourcequotasResource, name, data, subresources...), "a_v1.ClusterResourceQuota{}) + if obj == nil { + return nil, err + } + return obj.(*quota_v1.ClusterResourceQuota), err +} diff --git a/quota/clientset/versioned/typed/quota/v1/fake/fake_quota_client.go b/quota/clientset/versioned/typed/quota/v1/fake/fake_quota_client.go new file mode 100644 index 0000000000..0283beaab9 --- /dev/null +++ b/quota/clientset/versioned/typed/quota/v1/fake/fake_quota_client.go @@ -0,0 +1,26 @@ +package fake + +import ( + v1 "github.com/openshift/client-go/quota/clientset/versioned/typed/quota/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeQuotaV1 struct { + *testing.Fake +} + +func (c *FakeQuotaV1) AppliedClusterResourceQuotas(namespace string) v1.AppliedClusterResourceQuotaInterface { + return &FakeAppliedClusterResourceQuotas{c, namespace} +} + +func (c *FakeQuotaV1) ClusterResourceQuotas() v1.ClusterResourceQuotaInterface { + return &FakeClusterResourceQuotas{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeQuotaV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/quota/clientset/versioned/typed/quota/v1/generated_expansion.go b/quota/clientset/versioned/typed/quota/v1/generated_expansion.go new file mode 100644 index 0000000000..36b0f1b531 --- /dev/null +++ b/quota/clientset/versioned/typed/quota/v1/generated_expansion.go @@ -0,0 +1,5 @@ +package v1 + +type AppliedClusterResourceQuotaExpansion interface{} + +type ClusterResourceQuotaExpansion interface{} diff --git a/quota/clientset/versioned/typed/quota/v1/quota_client.go b/quota/clientset/versioned/typed/quota/v1/quota_client.go new file mode 100644 index 0000000000..7133d926ab --- /dev/null +++ b/quota/clientset/versioned/typed/quota/v1/quota_client.go @@ -0,0 +1,77 @@ +package v1 + +import ( + v1 "github.com/openshift/api/quota/v1" + "github.com/openshift/client-go/quota/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type QuotaV1Interface interface { + RESTClient() rest.Interface + AppliedClusterResourceQuotasGetter + ClusterResourceQuotasGetter +} + +// QuotaV1Client is used to interact with features provided by the quota.openshift.io group. +type QuotaV1Client struct { + restClient rest.Interface +} + +func (c *QuotaV1Client) AppliedClusterResourceQuotas(namespace string) AppliedClusterResourceQuotaInterface { + return newAppliedClusterResourceQuotas(c, namespace) +} + +func (c *QuotaV1Client) ClusterResourceQuotas() ClusterResourceQuotaInterface { + return newClusterResourceQuotas(c) +} + +// NewForConfig creates a new QuotaV1Client for the given config. +func NewForConfig(c *rest.Config) (*QuotaV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &QuotaV1Client{client}, nil +} + +// NewForConfigOrDie creates a new QuotaV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *QuotaV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new QuotaV1Client for the given RESTClient. +func New(c rest.Interface) *QuotaV1Client { + return &QuotaV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *QuotaV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/quota/informers/externalversions/factory.go b/quota/informers/externalversions/factory.go new file mode 100644 index 0000000000..f449c9334c --- /dev/null +++ b/quota/informers/externalversions/factory.go @@ -0,0 +1,102 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + versioned "github.com/openshift/client-go/quota/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/quota/informers/externalversions/internalinterfaces" + quota "github.com/openshift/client-go/quota/informers/externalversions/quota" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + reflect "reflect" + sync "sync" + time "time" +) + +type sharedInformerFactory struct { + client versioned.Interface + lock sync.Mutex + defaultResync time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return &sharedInformerFactory{ + client: client, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + } +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + informer = newFunc(f.client, f.defaultResync) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Quota() quota.Interface +} + +func (f *sharedInformerFactory) Quota() quota.Interface { + return quota.New(f) +} diff --git a/quota/informers/externalversions/generic.go b/quota/informers/externalversions/generic.go new file mode 100644 index 0000000000..4fa684c38c --- /dev/null +++ b/quota/informers/externalversions/generic.go @@ -0,0 +1,45 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + "fmt" + v1 "github.com/openshift/api/quota/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=Quota, Version=V1 + case v1.SchemeGroupVersion.WithResource("clusterresourcequotas"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Quota().V1().ClusterResourceQuotas().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/quota/informers/externalversions/internalinterfaces/factory_interfaces.go b/quota/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..34766ceb88 --- /dev/null +++ b/quota/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,18 @@ +// This file was automatically generated by informer-gen + +package internalinterfaces + +import ( + versioned "github.com/openshift/client-go/quota/clientset/versioned" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} diff --git a/quota/informers/externalversions/quota/interface.go b/quota/informers/externalversions/quota/interface.go new file mode 100644 index 0000000000..c3706752a7 --- /dev/null +++ b/quota/informers/externalversions/quota/interface.go @@ -0,0 +1,28 @@ +// This file was automatically generated by informer-gen + +package quota + +import ( + internalinterfaces "github.com/openshift/client-go/quota/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/quota/informers/externalversions/quota/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &group{f} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.SharedInformerFactory) +} diff --git a/quota/informers/externalversions/quota/v1/clusterresourcequota.go b/quota/informers/externalversions/quota/v1/clusterresourcequota.go new file mode 100644 index 0000000000..0ca5ae37d8 --- /dev/null +++ b/quota/informers/externalversions/quota/v1/clusterresourcequota.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + quota_v1 "github.com/openshift/api/quota/v1" + versioned "github.com/openshift/client-go/quota/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/quota/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/quota/listers/quota/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// ClusterResourceQuotaInformer provides access to a shared informer and lister for +// ClusterResourceQuotas. +type ClusterResourceQuotaInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ClusterResourceQuotaLister +} + +type clusterResourceQuotaInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewClusterResourceQuotaInformer constructs a new informer for ClusterResourceQuota type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterResourceQuotaInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.QuotaV1().ClusterResourceQuotas().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.QuotaV1().ClusterResourceQuotas().Watch(options) + }, + }, + "a_v1.ClusterResourceQuota{}, + resyncPeriod, + indexers, + ) +} + +func defaultClusterResourceQuotaInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewClusterResourceQuotaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *clusterResourceQuotaInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor("a_v1.ClusterResourceQuota{}, defaultClusterResourceQuotaInformer) +} + +func (f *clusterResourceQuotaInformer) Lister() v1.ClusterResourceQuotaLister { + return v1.NewClusterResourceQuotaLister(f.Informer().GetIndexer()) +} diff --git a/quota/informers/externalversions/quota/v1/interface.go b/quota/informers/externalversions/quota/v1/interface.go new file mode 100644 index 0000000000..b40344edd9 --- /dev/null +++ b/quota/informers/externalversions/quota/v1/interface.go @@ -0,0 +1,27 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + internalinterfaces "github.com/openshift/client-go/quota/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ClusterResourceQuotas returns a ClusterResourceQuotaInformer. + ClusterResourceQuotas() ClusterResourceQuotaInformer +} + +type version struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &version{f} +} + +// ClusterResourceQuotas returns a ClusterResourceQuotaInformer. +func (v *version) ClusterResourceQuotas() ClusterResourceQuotaInformer { + return &clusterResourceQuotaInformer{factory: v.SharedInformerFactory} +} diff --git a/quota/listers/quota/v1/appliedclusterresourcequota.go b/quota/listers/quota/v1/appliedclusterresourcequota.go new file mode 100644 index 0000000000..20c444c528 --- /dev/null +++ b/quota/listers/quota/v1/appliedclusterresourcequota.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/quota/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// AppliedClusterResourceQuotaLister helps list AppliedClusterResourceQuotas. +type AppliedClusterResourceQuotaLister interface { + // List lists all AppliedClusterResourceQuotas in the indexer. + List(selector labels.Selector) (ret []*v1.AppliedClusterResourceQuota, err error) + // AppliedClusterResourceQuotas returns an object that can list and get AppliedClusterResourceQuotas. + AppliedClusterResourceQuotas(namespace string) AppliedClusterResourceQuotaNamespaceLister + AppliedClusterResourceQuotaListerExpansion +} + +// appliedClusterResourceQuotaLister implements the AppliedClusterResourceQuotaLister interface. +type appliedClusterResourceQuotaLister struct { + indexer cache.Indexer +} + +// NewAppliedClusterResourceQuotaLister returns a new AppliedClusterResourceQuotaLister. +func NewAppliedClusterResourceQuotaLister(indexer cache.Indexer) AppliedClusterResourceQuotaLister { + return &appliedClusterResourceQuotaLister{indexer: indexer} +} + +// List lists all AppliedClusterResourceQuotas in the indexer. +func (s *appliedClusterResourceQuotaLister) List(selector labels.Selector) (ret []*v1.AppliedClusterResourceQuota, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.AppliedClusterResourceQuota)) + }) + return ret, err +} + +// AppliedClusterResourceQuotas returns an object that can list and get AppliedClusterResourceQuotas. +func (s *appliedClusterResourceQuotaLister) AppliedClusterResourceQuotas(namespace string) AppliedClusterResourceQuotaNamespaceLister { + return appliedClusterResourceQuotaNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// AppliedClusterResourceQuotaNamespaceLister helps list and get AppliedClusterResourceQuotas. +type AppliedClusterResourceQuotaNamespaceLister interface { + // List lists all AppliedClusterResourceQuotas in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.AppliedClusterResourceQuota, err error) + // Get retrieves the AppliedClusterResourceQuota from the indexer for a given namespace and name. + Get(name string) (*v1.AppliedClusterResourceQuota, error) + AppliedClusterResourceQuotaNamespaceListerExpansion +} + +// appliedClusterResourceQuotaNamespaceLister implements the AppliedClusterResourceQuotaNamespaceLister +// interface. +type appliedClusterResourceQuotaNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all AppliedClusterResourceQuotas in the indexer for a given namespace. +func (s appliedClusterResourceQuotaNamespaceLister) List(selector labels.Selector) (ret []*v1.AppliedClusterResourceQuota, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.AppliedClusterResourceQuota)) + }) + return ret, err +} + +// Get retrieves the AppliedClusterResourceQuota from the indexer for a given namespace and name. +func (s appliedClusterResourceQuotaNamespaceLister) Get(name string) (*v1.AppliedClusterResourceQuota, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("appliedclusterresourcequota"), name) + } + return obj.(*v1.AppliedClusterResourceQuota), nil +} diff --git a/quota/listers/quota/v1/clusterresourcequota.go b/quota/listers/quota/v1/clusterresourcequota.go new file mode 100644 index 0000000000..f45ce61a6b --- /dev/null +++ b/quota/listers/quota/v1/clusterresourcequota.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/quota/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterResourceQuotaLister helps list ClusterResourceQuotas. +type ClusterResourceQuotaLister interface { + // List lists all ClusterResourceQuotas in the indexer. + List(selector labels.Selector) (ret []*v1.ClusterResourceQuota, err error) + // Get retrieves the ClusterResourceQuota from the index for a given name. + Get(name string) (*v1.ClusterResourceQuota, error) + ClusterResourceQuotaListerExpansion +} + +// clusterResourceQuotaLister implements the ClusterResourceQuotaLister interface. +type clusterResourceQuotaLister struct { + indexer cache.Indexer +} + +// NewClusterResourceQuotaLister returns a new ClusterResourceQuotaLister. +func NewClusterResourceQuotaLister(indexer cache.Indexer) ClusterResourceQuotaLister { + return &clusterResourceQuotaLister{indexer: indexer} +} + +// List lists all ClusterResourceQuotas in the indexer. +func (s *clusterResourceQuotaLister) List(selector labels.Selector) (ret []*v1.ClusterResourceQuota, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterResourceQuota)) + }) + return ret, err +} + +// Get retrieves the ClusterResourceQuota from the index for a given name. +func (s *clusterResourceQuotaLister) Get(name string) (*v1.ClusterResourceQuota, error) { + key := &v1.ClusterResourceQuota{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("clusterresourcequota"), name) + } + return obj.(*v1.ClusterResourceQuota), nil +} diff --git a/quota/listers/quota/v1/expansion_generated.go b/quota/listers/quota/v1/expansion_generated.go new file mode 100644 index 0000000000..552a0fcc0d --- /dev/null +++ b/quota/listers/quota/v1/expansion_generated.go @@ -0,0 +1,15 @@ +// This file was automatically generated by lister-gen + +package v1 + +// AppliedClusterResourceQuotaListerExpansion allows custom methods to be added to +// AppliedClusterResourceQuotaLister. +type AppliedClusterResourceQuotaListerExpansion interface{} + +// AppliedClusterResourceQuotaNamespaceListerExpansion allows custom methods to be added to +// AppliedClusterResourceQuotaNamespaceLister. +type AppliedClusterResourceQuotaNamespaceListerExpansion interface{} + +// ClusterResourceQuotaListerExpansion allows custom methods to be added to +// ClusterResourceQuotaLister. +type ClusterResourceQuotaListerExpansion interface{} diff --git a/route/clientset/versioned/clientset.go b/route/clientset/versioned/clientset.go new file mode 100644 index 0000000000..9e31fdb783 --- /dev/null +++ b/route/clientset/versioned/clientset.go @@ -0,0 +1,82 @@ +package versioned + +import ( + glog "github.com/golang/glog" + routev1 "github.com/openshift/client-go/route/clientset/versioned/typed/route/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + RouteV1() routev1.RouteV1Interface + // Deprecated: please explicitly pick a version if possible. + Route() routev1.RouteV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + routeV1 *routev1.RouteV1Client +} + +// RouteV1 retrieves the RouteV1Client +func (c *Clientset) RouteV1() routev1.RouteV1Interface { + return c.routeV1 +} + +// Deprecated: Route retrieves the default version of RouteClient. +// Please explicitly pick a version. +func (c *Clientset) Route() routev1.RouteV1Interface { + return c.routeV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.routeV1, err = routev1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.routeV1 = routev1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.routeV1 = routev1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/route/clientset/versioned/doc.go b/route/clientset/versioned/doc.go new file mode 100644 index 0000000000..72f92921e6 --- /dev/null +++ b/route/clientset/versioned/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated clientset. +package versioned diff --git a/route/clientset/versioned/fake/clientset_generated.go b/route/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..0cf8fd6858 --- /dev/null +++ b/route/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,55 @@ +package fake + +import ( + clientset "github.com/openshift/client-go/route/clientset/versioned" + routev1 "github.com/openshift/client-go/route/clientset/versioned/typed/route/v1" + fakeroutev1 "github.com/openshift/client-go/route/clientset/versioned/typed/route/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := testing.Fake{} + fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) + fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// RouteV1 retrieves the RouteV1Client +func (c *Clientset) RouteV1() routev1.RouteV1Interface { + return &fakeroutev1.FakeRouteV1{Fake: &c.Fake} +} + +// Route retrieves the RouteV1Client +func (c *Clientset) Route() routev1.RouteV1Interface { + return &fakeroutev1.FakeRouteV1{Fake: &c.Fake} +} diff --git a/route/clientset/versioned/fake/doc.go b/route/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..760aaa8253 --- /dev/null +++ b/route/clientset/versioned/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated fake clientset. +package fake diff --git a/route/clientset/versioned/fake/register.go b/route/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..dc6be48ddb --- /dev/null +++ b/route/clientset/versioned/fake/register.go @@ -0,0 +1,37 @@ +package fake + +import ( + routev1 "github.com/openshift/api/route/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + routev1.AddToScheme(scheme) + +} diff --git a/route/clientset/versioned/scheme/doc.go b/route/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..d1c53d03b2 --- /dev/null +++ b/route/clientset/versioned/scheme/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/route/clientset/versioned/scheme/register.go b/route/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..48f7bf0430 --- /dev/null +++ b/route/clientset/versioned/scheme/register.go @@ -0,0 +1,37 @@ +package scheme + +import ( + routev1 "github.com/openshift/api/route/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + routev1.AddToScheme(scheme) + +} diff --git a/route/clientset/versioned/typed/route/v1/doc.go b/route/clientset/versioned/typed/route/v1/doc.go new file mode 100644 index 0000000000..0e93c2c5e7 --- /dev/null +++ b/route/clientset/versioned/typed/route/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated typed clients. +package v1 diff --git a/route/clientset/versioned/typed/route/v1/fake/doc.go b/route/clientset/versioned/typed/route/v1/fake/doc.go new file mode 100644 index 0000000000..e3bbd12a2b --- /dev/null +++ b/route/clientset/versioned/typed/route/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// Package fake has the automatically generated clients. +package fake diff --git a/route/clientset/versioned/typed/route/v1/fake/fake_route.go b/route/clientset/versioned/typed/route/v1/fake/fake_route.go new file mode 100644 index 0000000000..fd873696c2 --- /dev/null +++ b/route/clientset/versioned/typed/route/v1/fake/fake_route.go @@ -0,0 +1,122 @@ +package fake + +import ( + route_v1 "github.com/openshift/api/route/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeRoutes implements RouteInterface +type FakeRoutes struct { + Fake *FakeRouteV1 + ns string +} + +var routesResource = schema.GroupVersionResource{Group: "route.openshift.io", Version: "v1", Resource: "routes"} + +var routesKind = schema.GroupVersionKind{Group: "route.openshift.io", Version: "v1", Kind: "Route"} + +// Get takes name of the route, and returns the corresponding route object, and an error if there is any. +func (c *FakeRoutes) Get(name string, options v1.GetOptions) (result *route_v1.Route, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(routesResource, c.ns, name), &route_v1.Route{}) + + if obj == nil { + return nil, err + } + return obj.(*route_v1.Route), err +} + +// List takes label and field selectors, and returns the list of Routes that match those selectors. +func (c *FakeRoutes) List(opts v1.ListOptions) (result *route_v1.RouteList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(routesResource, routesKind, c.ns, opts), &route_v1.RouteList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &route_v1.RouteList{} + for _, item := range obj.(*route_v1.RouteList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested routes. +func (c *FakeRoutes) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(routesResource, c.ns, opts)) + +} + +// Create takes the representation of a route and creates it. Returns the server's representation of the route, and an error, if there is any. +func (c *FakeRoutes) Create(route *route_v1.Route) (result *route_v1.Route, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(routesResource, c.ns, route), &route_v1.Route{}) + + if obj == nil { + return nil, err + } + return obj.(*route_v1.Route), err +} + +// Update takes the representation of a route and updates it. Returns the server's representation of the route, and an error, if there is any. +func (c *FakeRoutes) Update(route *route_v1.Route) (result *route_v1.Route, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(routesResource, c.ns, route), &route_v1.Route{}) + + if obj == nil { + return nil, err + } + return obj.(*route_v1.Route), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeRoutes) UpdateStatus(route *route_v1.Route) (*route_v1.Route, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(routesResource, "status", c.ns, route), &route_v1.Route{}) + + if obj == nil { + return nil, err + } + return obj.(*route_v1.Route), err +} + +// Delete takes name of the route and deletes it. Returns an error if one occurs. +func (c *FakeRoutes) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(routesResource, c.ns, name), &route_v1.Route{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeRoutes) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(routesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &route_v1.RouteList{}) + return err +} + +// Patch applies the patch and returns the patched route. +func (c *FakeRoutes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *route_v1.Route, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(routesResource, c.ns, name, data, subresources...), &route_v1.Route{}) + + if obj == nil { + return nil, err + } + return obj.(*route_v1.Route), err +} diff --git a/route/clientset/versioned/typed/route/v1/fake/fake_route_client.go b/route/clientset/versioned/typed/route/v1/fake/fake_route_client.go new file mode 100644 index 0000000000..08d034341e --- /dev/null +++ b/route/clientset/versioned/typed/route/v1/fake/fake_route_client.go @@ -0,0 +1,22 @@ +package fake + +import ( + v1 "github.com/openshift/client-go/route/clientset/versioned/typed/route/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeRouteV1 struct { + *testing.Fake +} + +func (c *FakeRouteV1) Routes(namespace string) v1.RouteInterface { + return &FakeRoutes{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeRouteV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/route/clientset/versioned/typed/route/v1/generated_expansion.go b/route/clientset/versioned/typed/route/v1/generated_expansion.go new file mode 100644 index 0000000000..564f1c268d --- /dev/null +++ b/route/clientset/versioned/typed/route/v1/generated_expansion.go @@ -0,0 +1,3 @@ +package v1 + +type RouteExpansion interface{} diff --git a/route/clientset/versioned/typed/route/v1/route.go b/route/clientset/versioned/typed/route/v1/route.go new file mode 100644 index 0000000000..723f762fa6 --- /dev/null +++ b/route/clientset/versioned/typed/route/v1/route.go @@ -0,0 +1,156 @@ +package v1 + +import ( + v1 "github.com/openshift/api/route/v1" + scheme "github.com/openshift/client-go/route/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// RoutesGetter has a method to return a RouteInterface. +// A group's client should implement this interface. +type RoutesGetter interface { + Routes(namespace string) RouteInterface +} + +// RouteInterface has methods to work with Route resources. +type RouteInterface interface { + Create(*v1.Route) (*v1.Route, error) + Update(*v1.Route) (*v1.Route, error) + UpdateStatus(*v1.Route) (*v1.Route, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.Route, error) + List(opts meta_v1.ListOptions) (*v1.RouteList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Route, err error) + RouteExpansion +} + +// routes implements RouteInterface +type routes struct { + client rest.Interface + ns string +} + +// newRoutes returns a Routes +func newRoutes(c *RouteV1Client, namespace string) *routes { + return &routes{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the route, and returns the corresponding route object, and an error if there is any. +func (c *routes) Get(name string, options meta_v1.GetOptions) (result *v1.Route, err error) { + result = &v1.Route{} + err = c.client.Get(). + Namespace(c.ns). + Resource("routes"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Routes that match those selectors. +func (c *routes) List(opts meta_v1.ListOptions) (result *v1.RouteList, err error) { + result = &v1.RouteList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("routes"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested routes. +func (c *routes) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("routes"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a route and creates it. Returns the server's representation of the route, and an error, if there is any. +func (c *routes) Create(route *v1.Route) (result *v1.Route, err error) { + result = &v1.Route{} + err = c.client.Post(). + Namespace(c.ns). + Resource("routes"). + Body(route). + Do(). + Into(result) + return +} + +// Update takes the representation of a route and updates it. Returns the server's representation of the route, and an error, if there is any. +func (c *routes) Update(route *v1.Route) (result *v1.Route, err error) { + result = &v1.Route{} + err = c.client.Put(). + Namespace(c.ns). + Resource("routes"). + Name(route.Name). + Body(route). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *routes) UpdateStatus(route *v1.Route) (result *v1.Route, err error) { + result = &v1.Route{} + err = c.client.Put(). + Namespace(c.ns). + Resource("routes"). + Name(route.Name). + SubResource("status"). + Body(route). + Do(). + Into(result) + return +} + +// Delete takes name of the route and deletes it. Returns an error if one occurs. +func (c *routes) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("routes"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *routes) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("routes"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched route. +func (c *routes) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Route, err error) { + result = &v1.Route{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("routes"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/route/clientset/versioned/typed/route/v1/route_client.go b/route/clientset/versioned/typed/route/v1/route_client.go new file mode 100644 index 0000000000..cee30ee45b --- /dev/null +++ b/route/clientset/versioned/typed/route/v1/route_client.go @@ -0,0 +1,72 @@ +package v1 + +import ( + v1 "github.com/openshift/api/route/v1" + "github.com/openshift/client-go/route/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type RouteV1Interface interface { + RESTClient() rest.Interface + RoutesGetter +} + +// RouteV1Client is used to interact with features provided by the route.openshift.io group. +type RouteV1Client struct { + restClient rest.Interface +} + +func (c *RouteV1Client) Routes(namespace string) RouteInterface { + return newRoutes(c, namespace) +} + +// NewForConfig creates a new RouteV1Client for the given config. +func NewForConfig(c *rest.Config) (*RouteV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &RouteV1Client{client}, nil +} + +// NewForConfigOrDie creates a new RouteV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *RouteV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new RouteV1Client for the given RESTClient. +func New(c rest.Interface) *RouteV1Client { + return &RouteV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *RouteV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/route/informers/externalversions/factory.go b/route/informers/externalversions/factory.go new file mode 100644 index 0000000000..61309d133a --- /dev/null +++ b/route/informers/externalversions/factory.go @@ -0,0 +1,102 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + versioned "github.com/openshift/client-go/route/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/route/informers/externalversions/internalinterfaces" + route "github.com/openshift/client-go/route/informers/externalversions/route" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + reflect "reflect" + sync "sync" + time "time" +) + +type sharedInformerFactory struct { + client versioned.Interface + lock sync.Mutex + defaultResync time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return &sharedInformerFactory{ + client: client, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + } +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + informer = newFunc(f.client, f.defaultResync) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Route() route.Interface +} + +func (f *sharedInformerFactory) Route() route.Interface { + return route.New(f) +} diff --git a/route/informers/externalversions/generic.go b/route/informers/externalversions/generic.go new file mode 100644 index 0000000000..d47674feda --- /dev/null +++ b/route/informers/externalversions/generic.go @@ -0,0 +1,45 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + "fmt" + v1 "github.com/openshift/api/route/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=Route, Version=V1 + case v1.SchemeGroupVersion.WithResource("routes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Route().V1().Routes().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/route/informers/externalversions/internalinterfaces/factory_interfaces.go b/route/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..04e0c08646 --- /dev/null +++ b/route/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,18 @@ +// This file was automatically generated by informer-gen + +package internalinterfaces + +import ( + versioned "github.com/openshift/client-go/route/clientset/versioned" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} diff --git a/route/informers/externalversions/route/interface.go b/route/informers/externalversions/route/interface.go new file mode 100644 index 0000000000..1c94324ca4 --- /dev/null +++ b/route/informers/externalversions/route/interface.go @@ -0,0 +1,28 @@ +// This file was automatically generated by informer-gen + +package route + +import ( + internalinterfaces "github.com/openshift/client-go/route/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/route/informers/externalversions/route/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &group{f} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.SharedInformerFactory) +} diff --git a/route/informers/externalversions/route/v1/interface.go b/route/informers/externalversions/route/v1/interface.go new file mode 100644 index 0000000000..ed4371db27 --- /dev/null +++ b/route/informers/externalversions/route/v1/interface.go @@ -0,0 +1,27 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + internalinterfaces "github.com/openshift/client-go/route/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Routes returns a RouteInformer. + Routes() RouteInformer +} + +type version struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &version{f} +} + +// Routes returns a RouteInformer. +func (v *version) Routes() RouteInformer { + return &routeInformer{factory: v.SharedInformerFactory} +} diff --git a/route/informers/externalversions/route/v1/route.go b/route/informers/externalversions/route/v1/route.go new file mode 100644 index 0000000000..3972501c05 --- /dev/null +++ b/route/informers/externalversions/route/v1/route.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + route_v1 "github.com/openshift/api/route/v1" + versioned "github.com/openshift/client-go/route/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/route/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/route/listers/route/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// RouteInformer provides access to a shared informer and lister for +// Routes. +type RouteInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.RouteLister +} + +type routeInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewRouteInformer constructs a new informer for Route type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRouteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.RouteV1().Routes(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.RouteV1().Routes(namespace).Watch(options) + }, + }, + &route_v1.Route{}, + resyncPeriod, + indexers, + ) +} + +func defaultRouteInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewRouteInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *routeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&route_v1.Route{}, defaultRouteInformer) +} + +func (f *routeInformer) Lister() v1.RouteLister { + return v1.NewRouteLister(f.Informer().GetIndexer()) +} diff --git a/route/listers/route/v1/expansion_generated.go b/route/listers/route/v1/expansion_generated.go new file mode 100644 index 0000000000..9f598d91de --- /dev/null +++ b/route/listers/route/v1/expansion_generated.go @@ -0,0 +1,11 @@ +// This file was automatically generated by lister-gen + +package v1 + +// RouteListerExpansion allows custom methods to be added to +// RouteLister. +type RouteListerExpansion interface{} + +// RouteNamespaceListerExpansion allows custom methods to be added to +// RouteNamespaceLister. +type RouteNamespaceListerExpansion interface{} diff --git a/route/listers/route/v1/route.go b/route/listers/route/v1/route.go new file mode 100644 index 0000000000..34224923bd --- /dev/null +++ b/route/listers/route/v1/route.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/route/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RouteLister helps list Routes. +type RouteLister interface { + // List lists all Routes in the indexer. + List(selector labels.Selector) (ret []*v1.Route, err error) + // Routes returns an object that can list and get Routes. + Routes(namespace string) RouteNamespaceLister + RouteListerExpansion +} + +// routeLister implements the RouteLister interface. +type routeLister struct { + indexer cache.Indexer +} + +// NewRouteLister returns a new RouteLister. +func NewRouteLister(indexer cache.Indexer) RouteLister { + return &routeLister{indexer: indexer} +} + +// List lists all Routes in the indexer. +func (s *routeLister) List(selector labels.Selector) (ret []*v1.Route, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Route)) + }) + return ret, err +} + +// Routes returns an object that can list and get Routes. +func (s *routeLister) Routes(namespace string) RouteNamespaceLister { + return routeNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RouteNamespaceLister helps list and get Routes. +type RouteNamespaceLister interface { + // List lists all Routes in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.Route, err error) + // Get retrieves the Route from the indexer for a given namespace and name. + Get(name string) (*v1.Route, error) + RouteNamespaceListerExpansion +} + +// routeNamespaceLister implements the RouteNamespaceLister +// interface. +type routeNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Routes in the indexer for a given namespace. +func (s routeNamespaceLister) List(selector labels.Selector) (ret []*v1.Route, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Route)) + }) + return ret, err +} + +// Get retrieves the Route from the indexer for a given namespace and name. +func (s routeNamespaceLister) Get(name string) (*v1.Route, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("route"), name) + } + return obj.(*v1.Route), nil +} diff --git a/security/clientset/versioned/clientset.go b/security/clientset/versioned/clientset.go new file mode 100644 index 0000000000..8a8fb38103 --- /dev/null +++ b/security/clientset/versioned/clientset.go @@ -0,0 +1,82 @@ +package versioned + +import ( + glog "github.com/golang/glog" + securityv1 "github.com/openshift/client-go/security/clientset/versioned/typed/security/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + SecurityV1() securityv1.SecurityV1Interface + // Deprecated: please explicitly pick a version if possible. + Security() securityv1.SecurityV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + securityV1 *securityv1.SecurityV1Client +} + +// SecurityV1 retrieves the SecurityV1Client +func (c *Clientset) SecurityV1() securityv1.SecurityV1Interface { + return c.securityV1 +} + +// Deprecated: Security retrieves the default version of SecurityClient. +// Please explicitly pick a version. +func (c *Clientset) Security() securityv1.SecurityV1Interface { + return c.securityV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.securityV1, err = securityv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.securityV1 = securityv1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.securityV1 = securityv1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/security/clientset/versioned/doc.go b/security/clientset/versioned/doc.go new file mode 100644 index 0000000000..72f92921e6 --- /dev/null +++ b/security/clientset/versioned/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated clientset. +package versioned diff --git a/security/clientset/versioned/fake/clientset_generated.go b/security/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..65bb7299b9 --- /dev/null +++ b/security/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,55 @@ +package fake + +import ( + clientset "github.com/openshift/client-go/security/clientset/versioned" + securityv1 "github.com/openshift/client-go/security/clientset/versioned/typed/security/v1" + fakesecurityv1 "github.com/openshift/client-go/security/clientset/versioned/typed/security/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := testing.Fake{} + fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) + fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// SecurityV1 retrieves the SecurityV1Client +func (c *Clientset) SecurityV1() securityv1.SecurityV1Interface { + return &fakesecurityv1.FakeSecurityV1{Fake: &c.Fake} +} + +// Security retrieves the SecurityV1Client +func (c *Clientset) Security() securityv1.SecurityV1Interface { + return &fakesecurityv1.FakeSecurityV1{Fake: &c.Fake} +} diff --git a/security/clientset/versioned/fake/doc.go b/security/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..760aaa8253 --- /dev/null +++ b/security/clientset/versioned/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated fake clientset. +package fake diff --git a/security/clientset/versioned/fake/register.go b/security/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..ba0bfde49b --- /dev/null +++ b/security/clientset/versioned/fake/register.go @@ -0,0 +1,37 @@ +package fake + +import ( + securityv1 "github.com/openshift/api/security/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + securityv1.AddToScheme(scheme) + +} diff --git a/security/clientset/versioned/scheme/doc.go b/security/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..d1c53d03b2 --- /dev/null +++ b/security/clientset/versioned/scheme/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/security/clientset/versioned/scheme/register.go b/security/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..dfe452eb00 --- /dev/null +++ b/security/clientset/versioned/scheme/register.go @@ -0,0 +1,37 @@ +package scheme + +import ( + securityv1 "github.com/openshift/api/security/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + securityv1.AddToScheme(scheme) + +} diff --git a/security/clientset/versioned/typed/security/v1/doc.go b/security/clientset/versioned/typed/security/v1/doc.go new file mode 100644 index 0000000000..0e93c2c5e7 --- /dev/null +++ b/security/clientset/versioned/typed/security/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated typed clients. +package v1 diff --git a/security/clientset/versioned/typed/security/v1/fake/doc.go b/security/clientset/versioned/typed/security/v1/fake/doc.go new file mode 100644 index 0000000000..e3bbd12a2b --- /dev/null +++ b/security/clientset/versioned/typed/security/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// Package fake has the automatically generated clients. +package fake diff --git a/security/clientset/versioned/typed/security/v1/fake/fake_podsecuritypolicyreview.go b/security/clientset/versioned/typed/security/v1/fake/fake_podsecuritypolicyreview.go new file mode 100644 index 0000000000..ba6fcda0c4 --- /dev/null +++ b/security/clientset/versioned/typed/security/v1/fake/fake_podsecuritypolicyreview.go @@ -0,0 +1,28 @@ +package fake + +import ( + v1 "github.com/openshift/api/security/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakePodSecurityPolicyReviews implements PodSecurityPolicyReviewInterface +type FakePodSecurityPolicyReviews struct { + Fake *FakeSecurityV1 + ns string +} + +var podsecuritypolicyreviewsResource = schema.GroupVersionResource{Group: "security.openshift.io", Version: "v1", Resource: "podsecuritypolicyreviews"} + +var podsecuritypolicyreviewsKind = schema.GroupVersionKind{Group: "security.openshift.io", Version: "v1", Kind: "PodSecurityPolicyReview"} + +// Create takes the representation of a podSecurityPolicyReview and creates it. Returns the server's representation of the podSecurityPolicyReview, and an error, if there is any. +func (c *FakePodSecurityPolicyReviews) Create(podSecurityPolicyReview *v1.PodSecurityPolicyReview) (result *v1.PodSecurityPolicyReview, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(podsecuritypolicyreviewsResource, c.ns, podSecurityPolicyReview), &v1.PodSecurityPolicyReview{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PodSecurityPolicyReview), err +} diff --git a/security/clientset/versioned/typed/security/v1/fake/fake_podsecuritypolicyselfsubjectreview.go b/security/clientset/versioned/typed/security/v1/fake/fake_podsecuritypolicyselfsubjectreview.go new file mode 100644 index 0000000000..afcc5bda3e --- /dev/null +++ b/security/clientset/versioned/typed/security/v1/fake/fake_podsecuritypolicyselfsubjectreview.go @@ -0,0 +1,28 @@ +package fake + +import ( + v1 "github.com/openshift/api/security/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakePodSecurityPolicySelfSubjectReviews implements PodSecurityPolicySelfSubjectReviewInterface +type FakePodSecurityPolicySelfSubjectReviews struct { + Fake *FakeSecurityV1 + ns string +} + +var podsecuritypolicyselfsubjectreviewsResource = schema.GroupVersionResource{Group: "security.openshift.io", Version: "v1", Resource: "podsecuritypolicyselfsubjectreviews"} + +var podsecuritypolicyselfsubjectreviewsKind = schema.GroupVersionKind{Group: "security.openshift.io", Version: "v1", Kind: "PodSecurityPolicySelfSubjectReview"} + +// Create takes the representation of a podSecurityPolicySelfSubjectReview and creates it. Returns the server's representation of the podSecurityPolicySelfSubjectReview, and an error, if there is any. +func (c *FakePodSecurityPolicySelfSubjectReviews) Create(podSecurityPolicySelfSubjectReview *v1.PodSecurityPolicySelfSubjectReview) (result *v1.PodSecurityPolicySelfSubjectReview, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(podsecuritypolicyselfsubjectreviewsResource, c.ns, podSecurityPolicySelfSubjectReview), &v1.PodSecurityPolicySelfSubjectReview{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PodSecurityPolicySelfSubjectReview), err +} diff --git a/security/clientset/versioned/typed/security/v1/fake/fake_podsecuritypolicysubjectreview.go b/security/clientset/versioned/typed/security/v1/fake/fake_podsecuritypolicysubjectreview.go new file mode 100644 index 0000000000..36117a75e5 --- /dev/null +++ b/security/clientset/versioned/typed/security/v1/fake/fake_podsecuritypolicysubjectreview.go @@ -0,0 +1,28 @@ +package fake + +import ( + v1 "github.com/openshift/api/security/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakePodSecurityPolicySubjectReviews implements PodSecurityPolicySubjectReviewInterface +type FakePodSecurityPolicySubjectReviews struct { + Fake *FakeSecurityV1 + ns string +} + +var podsecuritypolicysubjectreviewsResource = schema.GroupVersionResource{Group: "security.openshift.io", Version: "v1", Resource: "podsecuritypolicysubjectreviews"} + +var podsecuritypolicysubjectreviewsKind = schema.GroupVersionKind{Group: "security.openshift.io", Version: "v1", Kind: "PodSecurityPolicySubjectReview"} + +// Create takes the representation of a podSecurityPolicySubjectReview and creates it. Returns the server's representation of the podSecurityPolicySubjectReview, and an error, if there is any. +func (c *FakePodSecurityPolicySubjectReviews) Create(podSecurityPolicySubjectReview *v1.PodSecurityPolicySubjectReview) (result *v1.PodSecurityPolicySubjectReview, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(podsecuritypolicysubjectreviewsResource, c.ns, podSecurityPolicySubjectReview), &v1.PodSecurityPolicySubjectReview{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.PodSecurityPolicySubjectReview), err +} diff --git a/security/clientset/versioned/typed/security/v1/fake/fake_security_client.go b/security/clientset/versioned/typed/security/v1/fake/fake_security_client.go new file mode 100644 index 0000000000..fb1b1171cc --- /dev/null +++ b/security/clientset/versioned/typed/security/v1/fake/fake_security_client.go @@ -0,0 +1,34 @@ +package fake + +import ( + v1 "github.com/openshift/client-go/security/clientset/versioned/typed/security/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeSecurityV1 struct { + *testing.Fake +} + +func (c *FakeSecurityV1) PodSecurityPolicyReviews(namespace string) v1.PodSecurityPolicyReviewInterface { + return &FakePodSecurityPolicyReviews{c, namespace} +} + +func (c *FakeSecurityV1) PodSecurityPolicySelfSubjectReviews(namespace string) v1.PodSecurityPolicySelfSubjectReviewInterface { + return &FakePodSecurityPolicySelfSubjectReviews{c, namespace} +} + +func (c *FakeSecurityV1) PodSecurityPolicySubjectReviews(namespace string) v1.PodSecurityPolicySubjectReviewInterface { + return &FakePodSecurityPolicySubjectReviews{c, namespace} +} + +func (c *FakeSecurityV1) SecurityContextConstraintses() v1.SecurityContextConstraintsInterface { + return &FakeSecurityContextConstraintses{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeSecurityV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/security/clientset/versioned/typed/security/v1/fake/fake_securitycontextconstraints.go b/security/clientset/versioned/typed/security/v1/fake/fake_securitycontextconstraints.go new file mode 100644 index 0000000000..c15aae0163 --- /dev/null +++ b/security/clientset/versioned/typed/security/v1/fake/fake_securitycontextconstraints.go @@ -0,0 +1,102 @@ +package fake + +import ( + security_v1 "github.com/openshift/api/security/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeSecurityContextConstraintses implements SecurityContextConstraintsInterface +type FakeSecurityContextConstraintses struct { + Fake *FakeSecurityV1 +} + +var securitycontextconstraintsesResource = schema.GroupVersionResource{Group: "security.openshift.io", Version: "v1", Resource: "securitycontextconstraintses"} + +var securitycontextconstraintsesKind = schema.GroupVersionKind{Group: "security.openshift.io", Version: "v1", Kind: "SecurityContextConstraints"} + +// Get takes name of the securityContextConstraints, and returns the corresponding securityContextConstraints object, and an error if there is any. +func (c *FakeSecurityContextConstraintses) Get(name string, options v1.GetOptions) (result *security_v1.SecurityContextConstraints, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(securitycontextconstraintsesResource, name), &security_v1.SecurityContextConstraints{}) + if obj == nil { + return nil, err + } + return obj.(*security_v1.SecurityContextConstraints), err +} + +// List takes label and field selectors, and returns the list of SecurityContextConstraintses that match those selectors. +func (c *FakeSecurityContextConstraintses) List(opts v1.ListOptions) (result *security_v1.SecurityContextConstraintsList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(securitycontextconstraintsesResource, securitycontextconstraintsesKind, opts), &security_v1.SecurityContextConstraintsList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &security_v1.SecurityContextConstraintsList{} + for _, item := range obj.(*security_v1.SecurityContextConstraintsList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested securityContextConstraintses. +func (c *FakeSecurityContextConstraintses) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(securitycontextconstraintsesResource, opts)) +} + +// Create takes the representation of a securityContextConstraints and creates it. Returns the server's representation of the securityContextConstraints, and an error, if there is any. +func (c *FakeSecurityContextConstraintses) Create(securityContextConstraints *security_v1.SecurityContextConstraints) (result *security_v1.SecurityContextConstraints, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(securitycontextconstraintsesResource, securityContextConstraints), &security_v1.SecurityContextConstraints{}) + if obj == nil { + return nil, err + } + return obj.(*security_v1.SecurityContextConstraints), err +} + +// Update takes the representation of a securityContextConstraints and updates it. Returns the server's representation of the securityContextConstraints, and an error, if there is any. +func (c *FakeSecurityContextConstraintses) Update(securityContextConstraints *security_v1.SecurityContextConstraints) (result *security_v1.SecurityContextConstraints, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(securitycontextconstraintsesResource, securityContextConstraints), &security_v1.SecurityContextConstraints{}) + if obj == nil { + return nil, err + } + return obj.(*security_v1.SecurityContextConstraints), err +} + +// Delete takes name of the securityContextConstraints and deletes it. Returns an error if one occurs. +func (c *FakeSecurityContextConstraintses) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(securitycontextconstraintsesResource, name), &security_v1.SecurityContextConstraints{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSecurityContextConstraintses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(securitycontextconstraintsesResource, listOptions) + + _, err := c.Fake.Invokes(action, &security_v1.SecurityContextConstraintsList{}) + return err +} + +// Patch applies the patch and returns the patched securityContextConstraints. +func (c *FakeSecurityContextConstraintses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *security_v1.SecurityContextConstraints, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(securitycontextconstraintsesResource, name, data, subresources...), &security_v1.SecurityContextConstraints{}) + if obj == nil { + return nil, err + } + return obj.(*security_v1.SecurityContextConstraints), err +} diff --git a/security/clientset/versioned/typed/security/v1/generated_expansion.go b/security/clientset/versioned/typed/security/v1/generated_expansion.go new file mode 100644 index 0000000000..3ea12327ec --- /dev/null +++ b/security/clientset/versioned/typed/security/v1/generated_expansion.go @@ -0,0 +1,9 @@ +package v1 + +type PodSecurityPolicyReviewExpansion interface{} + +type PodSecurityPolicySelfSubjectReviewExpansion interface{} + +type PodSecurityPolicySubjectReviewExpansion interface{} + +type SecurityContextConstraintsExpansion interface{} diff --git a/security/clientset/versioned/typed/security/v1/podsecuritypolicyreview.go b/security/clientset/versioned/typed/security/v1/podsecuritypolicyreview.go new file mode 100644 index 0000000000..71cbd0ea38 --- /dev/null +++ b/security/clientset/versioned/typed/security/v1/podsecuritypolicyreview.go @@ -0,0 +1,44 @@ +package v1 + +import ( + v1 "github.com/openshift/api/security/v1" + rest "k8s.io/client-go/rest" +) + +// PodSecurityPolicyReviewsGetter has a method to return a PodSecurityPolicyReviewInterface. +// A group's client should implement this interface. +type PodSecurityPolicyReviewsGetter interface { + PodSecurityPolicyReviews(namespace string) PodSecurityPolicyReviewInterface +} + +// PodSecurityPolicyReviewInterface has methods to work with PodSecurityPolicyReview resources. +type PodSecurityPolicyReviewInterface interface { + Create(*v1.PodSecurityPolicyReview) (*v1.PodSecurityPolicyReview, error) + PodSecurityPolicyReviewExpansion +} + +// podSecurityPolicyReviews implements PodSecurityPolicyReviewInterface +type podSecurityPolicyReviews struct { + client rest.Interface + ns string +} + +// newPodSecurityPolicyReviews returns a PodSecurityPolicyReviews +func newPodSecurityPolicyReviews(c *SecurityV1Client, namespace string) *podSecurityPolicyReviews { + return &podSecurityPolicyReviews{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a podSecurityPolicyReview and creates it. Returns the server's representation of the podSecurityPolicyReview, and an error, if there is any. +func (c *podSecurityPolicyReviews) Create(podSecurityPolicyReview *v1.PodSecurityPolicyReview) (result *v1.PodSecurityPolicyReview, err error) { + result = &v1.PodSecurityPolicyReview{} + err = c.client.Post(). + Namespace(c.ns). + Resource("podsecuritypolicyreviews"). + Body(podSecurityPolicyReview). + Do(). + Into(result) + return +} diff --git a/security/clientset/versioned/typed/security/v1/podsecuritypolicyselfsubjectreview.go b/security/clientset/versioned/typed/security/v1/podsecuritypolicyselfsubjectreview.go new file mode 100644 index 0000000000..c83af28e33 --- /dev/null +++ b/security/clientset/versioned/typed/security/v1/podsecuritypolicyselfsubjectreview.go @@ -0,0 +1,44 @@ +package v1 + +import ( + v1 "github.com/openshift/api/security/v1" + rest "k8s.io/client-go/rest" +) + +// PodSecurityPolicySelfSubjectReviewsGetter has a method to return a PodSecurityPolicySelfSubjectReviewInterface. +// A group's client should implement this interface. +type PodSecurityPolicySelfSubjectReviewsGetter interface { + PodSecurityPolicySelfSubjectReviews(namespace string) PodSecurityPolicySelfSubjectReviewInterface +} + +// PodSecurityPolicySelfSubjectReviewInterface has methods to work with PodSecurityPolicySelfSubjectReview resources. +type PodSecurityPolicySelfSubjectReviewInterface interface { + Create(*v1.PodSecurityPolicySelfSubjectReview) (*v1.PodSecurityPolicySelfSubjectReview, error) + PodSecurityPolicySelfSubjectReviewExpansion +} + +// podSecurityPolicySelfSubjectReviews implements PodSecurityPolicySelfSubjectReviewInterface +type podSecurityPolicySelfSubjectReviews struct { + client rest.Interface + ns string +} + +// newPodSecurityPolicySelfSubjectReviews returns a PodSecurityPolicySelfSubjectReviews +func newPodSecurityPolicySelfSubjectReviews(c *SecurityV1Client, namespace string) *podSecurityPolicySelfSubjectReviews { + return &podSecurityPolicySelfSubjectReviews{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a podSecurityPolicySelfSubjectReview and creates it. Returns the server's representation of the podSecurityPolicySelfSubjectReview, and an error, if there is any. +func (c *podSecurityPolicySelfSubjectReviews) Create(podSecurityPolicySelfSubjectReview *v1.PodSecurityPolicySelfSubjectReview) (result *v1.PodSecurityPolicySelfSubjectReview, err error) { + result = &v1.PodSecurityPolicySelfSubjectReview{} + err = c.client.Post(). + Namespace(c.ns). + Resource("podsecuritypolicyselfsubjectreviews"). + Body(podSecurityPolicySelfSubjectReview). + Do(). + Into(result) + return +} diff --git a/security/clientset/versioned/typed/security/v1/podsecuritypolicysubjectreview.go b/security/clientset/versioned/typed/security/v1/podsecuritypolicysubjectreview.go new file mode 100644 index 0000000000..f21b64f779 --- /dev/null +++ b/security/clientset/versioned/typed/security/v1/podsecuritypolicysubjectreview.go @@ -0,0 +1,44 @@ +package v1 + +import ( + v1 "github.com/openshift/api/security/v1" + rest "k8s.io/client-go/rest" +) + +// PodSecurityPolicySubjectReviewsGetter has a method to return a PodSecurityPolicySubjectReviewInterface. +// A group's client should implement this interface. +type PodSecurityPolicySubjectReviewsGetter interface { + PodSecurityPolicySubjectReviews(namespace string) PodSecurityPolicySubjectReviewInterface +} + +// PodSecurityPolicySubjectReviewInterface has methods to work with PodSecurityPolicySubjectReview resources. +type PodSecurityPolicySubjectReviewInterface interface { + Create(*v1.PodSecurityPolicySubjectReview) (*v1.PodSecurityPolicySubjectReview, error) + PodSecurityPolicySubjectReviewExpansion +} + +// podSecurityPolicySubjectReviews implements PodSecurityPolicySubjectReviewInterface +type podSecurityPolicySubjectReviews struct { + client rest.Interface + ns string +} + +// newPodSecurityPolicySubjectReviews returns a PodSecurityPolicySubjectReviews +func newPodSecurityPolicySubjectReviews(c *SecurityV1Client, namespace string) *podSecurityPolicySubjectReviews { + return &podSecurityPolicySubjectReviews{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Create takes the representation of a podSecurityPolicySubjectReview and creates it. Returns the server's representation of the podSecurityPolicySubjectReview, and an error, if there is any. +func (c *podSecurityPolicySubjectReviews) Create(podSecurityPolicySubjectReview *v1.PodSecurityPolicySubjectReview) (result *v1.PodSecurityPolicySubjectReview, err error) { + result = &v1.PodSecurityPolicySubjectReview{} + err = c.client.Post(). + Namespace(c.ns). + Resource("podsecuritypolicysubjectreviews"). + Body(podSecurityPolicySubjectReview). + Do(). + Into(result) + return +} diff --git a/security/clientset/versioned/typed/security/v1/security_client.go b/security/clientset/versioned/typed/security/v1/security_client.go new file mode 100644 index 0000000000..0125f99d9e --- /dev/null +++ b/security/clientset/versioned/typed/security/v1/security_client.go @@ -0,0 +1,87 @@ +package v1 + +import ( + v1 "github.com/openshift/api/security/v1" + "github.com/openshift/client-go/security/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type SecurityV1Interface interface { + RESTClient() rest.Interface + PodSecurityPolicyReviewsGetter + PodSecurityPolicySelfSubjectReviewsGetter + PodSecurityPolicySubjectReviewsGetter + SecurityContextConstraintsesGetter +} + +// SecurityV1Client is used to interact with features provided by the security.openshift.io group. +type SecurityV1Client struct { + restClient rest.Interface +} + +func (c *SecurityV1Client) PodSecurityPolicyReviews(namespace string) PodSecurityPolicyReviewInterface { + return newPodSecurityPolicyReviews(c, namespace) +} + +func (c *SecurityV1Client) PodSecurityPolicySelfSubjectReviews(namespace string) PodSecurityPolicySelfSubjectReviewInterface { + return newPodSecurityPolicySelfSubjectReviews(c, namespace) +} + +func (c *SecurityV1Client) PodSecurityPolicySubjectReviews(namespace string) PodSecurityPolicySubjectReviewInterface { + return newPodSecurityPolicySubjectReviews(c, namespace) +} + +func (c *SecurityV1Client) SecurityContextConstraintses() SecurityContextConstraintsInterface { + return newSecurityContextConstraintses(c) +} + +// NewForConfig creates a new SecurityV1Client for the given config. +func NewForConfig(c *rest.Config) (*SecurityV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &SecurityV1Client{client}, nil +} + +// NewForConfigOrDie creates a new SecurityV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *SecurityV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new SecurityV1Client for the given RESTClient. +func New(c rest.Interface) *SecurityV1Client { + return &SecurityV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *SecurityV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/security/clientset/versioned/typed/security/v1/securitycontextconstraints.go b/security/clientset/versioned/typed/security/v1/securitycontextconstraints.go new file mode 100644 index 0000000000..2495c62628 --- /dev/null +++ b/security/clientset/versioned/typed/security/v1/securitycontextconstraints.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/security/v1" + scheme "github.com/openshift/client-go/security/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// SecurityContextConstraintsesGetter has a method to return a SecurityContextConstraintsInterface. +// A group's client should implement this interface. +type SecurityContextConstraintsesGetter interface { + SecurityContextConstraintses() SecurityContextConstraintsInterface +} + +// SecurityContextConstraintsInterface has methods to work with SecurityContextConstraints resources. +type SecurityContextConstraintsInterface interface { + Create(*v1.SecurityContextConstraints) (*v1.SecurityContextConstraints, error) + Update(*v1.SecurityContextConstraints) (*v1.SecurityContextConstraints, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.SecurityContextConstraints, error) + List(opts meta_v1.ListOptions) (*v1.SecurityContextConstraintsList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.SecurityContextConstraints, err error) + SecurityContextConstraintsExpansion +} + +// securityContextConstraintses implements SecurityContextConstraintsInterface +type securityContextConstraintses struct { + client rest.Interface +} + +// newSecurityContextConstraintses returns a SecurityContextConstraintses +func newSecurityContextConstraintses(c *SecurityV1Client) *securityContextConstraintses { + return &securityContextConstraintses{ + client: c.RESTClient(), + } +} + +// Get takes name of the securityContextConstraints, and returns the corresponding securityContextConstraints object, and an error if there is any. +func (c *securityContextConstraintses) Get(name string, options meta_v1.GetOptions) (result *v1.SecurityContextConstraints, err error) { + result = &v1.SecurityContextConstraints{} + err = c.client.Get(). + Resource("securitycontextconstraintses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of SecurityContextConstraintses that match those selectors. +func (c *securityContextConstraintses) List(opts meta_v1.ListOptions) (result *v1.SecurityContextConstraintsList, err error) { + result = &v1.SecurityContextConstraintsList{} + err = c.client.Get(). + Resource("securitycontextconstraintses"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested securityContextConstraintses. +func (c *securityContextConstraintses) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("securitycontextconstraintses"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a securityContextConstraints and creates it. Returns the server's representation of the securityContextConstraints, and an error, if there is any. +func (c *securityContextConstraintses) Create(securityContextConstraints *v1.SecurityContextConstraints) (result *v1.SecurityContextConstraints, err error) { + result = &v1.SecurityContextConstraints{} + err = c.client.Post(). + Resource("securitycontextconstraintses"). + Body(securityContextConstraints). + Do(). + Into(result) + return +} + +// Update takes the representation of a securityContextConstraints and updates it. Returns the server's representation of the securityContextConstraints, and an error, if there is any. +func (c *securityContextConstraintses) Update(securityContextConstraints *v1.SecurityContextConstraints) (result *v1.SecurityContextConstraints, err error) { + result = &v1.SecurityContextConstraints{} + err = c.client.Put(). + Resource("securitycontextconstraintses"). + Name(securityContextConstraints.Name). + Body(securityContextConstraints). + Do(). + Into(result) + return +} + +// Delete takes name of the securityContextConstraints and deletes it. Returns an error if one occurs. +func (c *securityContextConstraintses) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("securitycontextconstraintses"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *securityContextConstraintses) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("securitycontextconstraintses"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched securityContextConstraints. +func (c *securityContextConstraintses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.SecurityContextConstraints, err error) { + result = &v1.SecurityContextConstraints{} + err = c.client.Patch(pt). + Resource("securitycontextconstraintses"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/security/informers/externalversions/factory.go b/security/informers/externalversions/factory.go new file mode 100644 index 0000000000..8fb112e667 --- /dev/null +++ b/security/informers/externalversions/factory.go @@ -0,0 +1,102 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + versioned "github.com/openshift/client-go/security/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/security/informers/externalversions/internalinterfaces" + security "github.com/openshift/client-go/security/informers/externalversions/security" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + reflect "reflect" + sync "sync" + time "time" +) + +type sharedInformerFactory struct { + client versioned.Interface + lock sync.Mutex + defaultResync time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return &sharedInformerFactory{ + client: client, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + } +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + informer = newFunc(f.client, f.defaultResync) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Security() security.Interface +} + +func (f *sharedInformerFactory) Security() security.Interface { + return security.New(f) +} diff --git a/security/informers/externalversions/generic.go b/security/informers/externalversions/generic.go new file mode 100644 index 0000000000..fb199e0901 --- /dev/null +++ b/security/informers/externalversions/generic.go @@ -0,0 +1,45 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + "fmt" + v1 "github.com/openshift/api/security/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=Security, Version=V1 + case v1.SchemeGroupVersion.WithResource("securitycontextconstraintses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Security().V1().SecurityContextConstraintses().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/security/informers/externalversions/internalinterfaces/factory_interfaces.go b/security/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..77a3829f37 --- /dev/null +++ b/security/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,18 @@ +// This file was automatically generated by informer-gen + +package internalinterfaces + +import ( + versioned "github.com/openshift/client-go/security/clientset/versioned" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} diff --git a/security/informers/externalversions/security/interface.go b/security/informers/externalversions/security/interface.go new file mode 100644 index 0000000000..6715fe4cc2 --- /dev/null +++ b/security/informers/externalversions/security/interface.go @@ -0,0 +1,28 @@ +// This file was automatically generated by informer-gen + +package security + +import ( + internalinterfaces "github.com/openshift/client-go/security/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/security/informers/externalversions/security/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &group{f} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.SharedInformerFactory) +} diff --git a/security/informers/externalversions/security/v1/interface.go b/security/informers/externalversions/security/v1/interface.go new file mode 100644 index 0000000000..169e98726d --- /dev/null +++ b/security/informers/externalversions/security/v1/interface.go @@ -0,0 +1,27 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + internalinterfaces "github.com/openshift/client-go/security/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // SecurityContextConstraintses returns a SecurityContextConstraintsInformer. + SecurityContextConstraintses() SecurityContextConstraintsInformer +} + +type version struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &version{f} +} + +// SecurityContextConstraintses returns a SecurityContextConstraintsInformer. +func (v *version) SecurityContextConstraintses() SecurityContextConstraintsInformer { + return &securityContextConstraintsInformer{factory: v.SharedInformerFactory} +} diff --git a/security/informers/externalversions/security/v1/securitycontextconstraints.go b/security/informers/externalversions/security/v1/securitycontextconstraints.go new file mode 100644 index 0000000000..c833d54e23 --- /dev/null +++ b/security/informers/externalversions/security/v1/securitycontextconstraints.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + security_v1 "github.com/openshift/api/security/v1" + versioned "github.com/openshift/client-go/security/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/security/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/security/listers/security/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// SecurityContextConstraintsInformer provides access to a shared informer and lister for +// SecurityContextConstraintses. +type SecurityContextConstraintsInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.SecurityContextConstraintsLister +} + +type securityContextConstraintsInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewSecurityContextConstraintsInformer constructs a new informer for SecurityContextConstraints type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSecurityContextConstraintsInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.SecurityV1().SecurityContextConstraintses().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.SecurityV1().SecurityContextConstraintses().Watch(options) + }, + }, + &security_v1.SecurityContextConstraints{}, + resyncPeriod, + indexers, + ) +} + +func defaultSecurityContextConstraintsInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewSecurityContextConstraintsInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *securityContextConstraintsInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&security_v1.SecurityContextConstraints{}, defaultSecurityContextConstraintsInformer) +} + +func (f *securityContextConstraintsInformer) Lister() v1.SecurityContextConstraintsLister { + return v1.NewSecurityContextConstraintsLister(f.Informer().GetIndexer()) +} diff --git a/security/listers/security/v1/expansion_generated.go b/security/listers/security/v1/expansion_generated.go new file mode 100644 index 0000000000..6c1f17afb6 --- /dev/null +++ b/security/listers/security/v1/expansion_generated.go @@ -0,0 +1,7 @@ +// This file was automatically generated by lister-gen + +package v1 + +// SecurityContextConstraintsListerExpansion allows custom methods to be added to +// SecurityContextConstraintsLister. +type SecurityContextConstraintsListerExpansion interface{} diff --git a/security/listers/security/v1/securitycontextconstraints.go b/security/listers/security/v1/securitycontextconstraints.go new file mode 100644 index 0000000000..7fed7bd8b3 --- /dev/null +++ b/security/listers/security/v1/securitycontextconstraints.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/security/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SecurityContextConstraintsLister helps list SecurityContextConstraintses. +type SecurityContextConstraintsLister interface { + // List lists all SecurityContextConstraintses in the indexer. + List(selector labels.Selector) (ret []*v1.SecurityContextConstraints, err error) + // Get retrieves the SecurityContextConstraints from the index for a given name. + Get(name string) (*v1.SecurityContextConstraints, error) + SecurityContextConstraintsListerExpansion +} + +// securityContextConstraintsLister implements the SecurityContextConstraintsLister interface. +type securityContextConstraintsLister struct { + indexer cache.Indexer +} + +// NewSecurityContextConstraintsLister returns a new SecurityContextConstraintsLister. +func NewSecurityContextConstraintsLister(indexer cache.Indexer) SecurityContextConstraintsLister { + return &securityContextConstraintsLister{indexer: indexer} +} + +// List lists all SecurityContextConstraintses in the indexer. +func (s *securityContextConstraintsLister) List(selector labels.Selector) (ret []*v1.SecurityContextConstraints, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.SecurityContextConstraints)) + }) + return ret, err +} + +// Get retrieves the SecurityContextConstraints from the index for a given name. +func (s *securityContextConstraintsLister) Get(name string) (*v1.SecurityContextConstraints, error) { + key := &v1.SecurityContextConstraints{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("securitycontextconstraints"), name) + } + return obj.(*v1.SecurityContextConstraints), nil +} diff --git a/template/clientset/versioned/clientset.go b/template/clientset/versioned/clientset.go new file mode 100644 index 0000000000..09864312a2 --- /dev/null +++ b/template/clientset/versioned/clientset.go @@ -0,0 +1,82 @@ +package versioned + +import ( + glog "github.com/golang/glog" + templatev1 "github.com/openshift/client-go/template/clientset/versioned/typed/template/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + TemplateV1() templatev1.TemplateV1Interface + // Deprecated: please explicitly pick a version if possible. + Template() templatev1.TemplateV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + templateV1 *templatev1.TemplateV1Client +} + +// TemplateV1 retrieves the TemplateV1Client +func (c *Clientset) TemplateV1() templatev1.TemplateV1Interface { + return c.templateV1 +} + +// Deprecated: Template retrieves the default version of TemplateClient. +// Please explicitly pick a version. +func (c *Clientset) Template() templatev1.TemplateV1Interface { + return c.templateV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.templateV1, err = templatev1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.templateV1 = templatev1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.templateV1 = templatev1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/template/clientset/versioned/doc.go b/template/clientset/versioned/doc.go new file mode 100644 index 0000000000..72f92921e6 --- /dev/null +++ b/template/clientset/versioned/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated clientset. +package versioned diff --git a/template/clientset/versioned/fake/clientset_generated.go b/template/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..46fed93271 --- /dev/null +++ b/template/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,55 @@ +package fake + +import ( + clientset "github.com/openshift/client-go/template/clientset/versioned" + templatev1 "github.com/openshift/client-go/template/clientset/versioned/typed/template/v1" + faketemplatev1 "github.com/openshift/client-go/template/clientset/versioned/typed/template/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := testing.Fake{} + fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) + fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// TemplateV1 retrieves the TemplateV1Client +func (c *Clientset) TemplateV1() templatev1.TemplateV1Interface { + return &faketemplatev1.FakeTemplateV1{Fake: &c.Fake} +} + +// Template retrieves the TemplateV1Client +func (c *Clientset) Template() templatev1.TemplateV1Interface { + return &faketemplatev1.FakeTemplateV1{Fake: &c.Fake} +} diff --git a/template/clientset/versioned/fake/doc.go b/template/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..760aaa8253 --- /dev/null +++ b/template/clientset/versioned/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated fake clientset. +package fake diff --git a/template/clientset/versioned/fake/register.go b/template/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..f1df037bc0 --- /dev/null +++ b/template/clientset/versioned/fake/register.go @@ -0,0 +1,37 @@ +package fake + +import ( + templatev1 "github.com/openshift/api/template/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + templatev1.AddToScheme(scheme) + +} diff --git a/template/clientset/versioned/scheme/doc.go b/template/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..d1c53d03b2 --- /dev/null +++ b/template/clientset/versioned/scheme/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/template/clientset/versioned/scheme/register.go b/template/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..957384c88b --- /dev/null +++ b/template/clientset/versioned/scheme/register.go @@ -0,0 +1,37 @@ +package scheme + +import ( + templatev1 "github.com/openshift/api/template/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + templatev1.AddToScheme(scheme) + +} diff --git a/template/clientset/versioned/typed/template/v1/brokertemplateinstance.go b/template/clientset/versioned/typed/template/v1/brokertemplateinstance.go new file mode 100644 index 0000000000..430043c61b --- /dev/null +++ b/template/clientset/versioned/typed/template/v1/brokertemplateinstance.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/template/v1" + scheme "github.com/openshift/client-go/template/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// BrokerTemplateInstancesGetter has a method to return a BrokerTemplateInstanceInterface. +// A group's client should implement this interface. +type BrokerTemplateInstancesGetter interface { + BrokerTemplateInstances() BrokerTemplateInstanceInterface +} + +// BrokerTemplateInstanceInterface has methods to work with BrokerTemplateInstance resources. +type BrokerTemplateInstanceInterface interface { + Create(*v1.BrokerTemplateInstance) (*v1.BrokerTemplateInstance, error) + Update(*v1.BrokerTemplateInstance) (*v1.BrokerTemplateInstance, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.BrokerTemplateInstance, error) + List(opts meta_v1.ListOptions) (*v1.BrokerTemplateInstanceList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.BrokerTemplateInstance, err error) + BrokerTemplateInstanceExpansion +} + +// brokerTemplateInstances implements BrokerTemplateInstanceInterface +type brokerTemplateInstances struct { + client rest.Interface +} + +// newBrokerTemplateInstances returns a BrokerTemplateInstances +func newBrokerTemplateInstances(c *TemplateV1Client) *brokerTemplateInstances { + return &brokerTemplateInstances{ + client: c.RESTClient(), + } +} + +// Get takes name of the brokerTemplateInstance, and returns the corresponding brokerTemplateInstance object, and an error if there is any. +func (c *brokerTemplateInstances) Get(name string, options meta_v1.GetOptions) (result *v1.BrokerTemplateInstance, err error) { + result = &v1.BrokerTemplateInstance{} + err = c.client.Get(). + Resource("brokertemplateinstances"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of BrokerTemplateInstances that match those selectors. +func (c *brokerTemplateInstances) List(opts meta_v1.ListOptions) (result *v1.BrokerTemplateInstanceList, err error) { + result = &v1.BrokerTemplateInstanceList{} + err = c.client.Get(). + Resource("brokertemplateinstances"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested brokerTemplateInstances. +func (c *brokerTemplateInstances) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("brokertemplateinstances"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a brokerTemplateInstance and creates it. Returns the server's representation of the brokerTemplateInstance, and an error, if there is any. +func (c *brokerTemplateInstances) Create(brokerTemplateInstance *v1.BrokerTemplateInstance) (result *v1.BrokerTemplateInstance, err error) { + result = &v1.BrokerTemplateInstance{} + err = c.client.Post(). + Resource("brokertemplateinstances"). + Body(brokerTemplateInstance). + Do(). + Into(result) + return +} + +// Update takes the representation of a brokerTemplateInstance and updates it. Returns the server's representation of the brokerTemplateInstance, and an error, if there is any. +func (c *brokerTemplateInstances) Update(brokerTemplateInstance *v1.BrokerTemplateInstance) (result *v1.BrokerTemplateInstance, err error) { + result = &v1.BrokerTemplateInstance{} + err = c.client.Put(). + Resource("brokertemplateinstances"). + Name(brokerTemplateInstance.Name). + Body(brokerTemplateInstance). + Do(). + Into(result) + return +} + +// Delete takes name of the brokerTemplateInstance and deletes it. Returns an error if one occurs. +func (c *brokerTemplateInstances) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("brokertemplateinstances"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *brokerTemplateInstances) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("brokertemplateinstances"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched brokerTemplateInstance. +func (c *brokerTemplateInstances) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.BrokerTemplateInstance, err error) { + result = &v1.BrokerTemplateInstance{} + err = c.client.Patch(pt). + Resource("brokertemplateinstances"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/template/clientset/versioned/typed/template/v1/doc.go b/template/clientset/versioned/typed/template/v1/doc.go new file mode 100644 index 0000000000..0e93c2c5e7 --- /dev/null +++ b/template/clientset/versioned/typed/template/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated typed clients. +package v1 diff --git a/template/clientset/versioned/typed/template/v1/fake/doc.go b/template/clientset/versioned/typed/template/v1/fake/doc.go new file mode 100644 index 0000000000..e3bbd12a2b --- /dev/null +++ b/template/clientset/versioned/typed/template/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// Package fake has the automatically generated clients. +package fake diff --git a/template/clientset/versioned/typed/template/v1/fake/fake_brokertemplateinstance.go b/template/clientset/versioned/typed/template/v1/fake/fake_brokertemplateinstance.go new file mode 100644 index 0000000000..732611a586 --- /dev/null +++ b/template/clientset/versioned/typed/template/v1/fake/fake_brokertemplateinstance.go @@ -0,0 +1,102 @@ +package fake + +import ( + template_v1 "github.com/openshift/api/template/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeBrokerTemplateInstances implements BrokerTemplateInstanceInterface +type FakeBrokerTemplateInstances struct { + Fake *FakeTemplateV1 +} + +var brokertemplateinstancesResource = schema.GroupVersionResource{Group: "template.openshift.io", Version: "v1", Resource: "brokertemplateinstances"} + +var brokertemplateinstancesKind = schema.GroupVersionKind{Group: "template.openshift.io", Version: "v1", Kind: "BrokerTemplateInstance"} + +// Get takes name of the brokerTemplateInstance, and returns the corresponding brokerTemplateInstance object, and an error if there is any. +func (c *FakeBrokerTemplateInstances) Get(name string, options v1.GetOptions) (result *template_v1.BrokerTemplateInstance, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(brokertemplateinstancesResource, name), &template_v1.BrokerTemplateInstance{}) + if obj == nil { + return nil, err + } + return obj.(*template_v1.BrokerTemplateInstance), err +} + +// List takes label and field selectors, and returns the list of BrokerTemplateInstances that match those selectors. +func (c *FakeBrokerTemplateInstances) List(opts v1.ListOptions) (result *template_v1.BrokerTemplateInstanceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(brokertemplateinstancesResource, brokertemplateinstancesKind, opts), &template_v1.BrokerTemplateInstanceList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &template_v1.BrokerTemplateInstanceList{} + for _, item := range obj.(*template_v1.BrokerTemplateInstanceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested brokerTemplateInstances. +func (c *FakeBrokerTemplateInstances) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(brokertemplateinstancesResource, opts)) +} + +// Create takes the representation of a brokerTemplateInstance and creates it. Returns the server's representation of the brokerTemplateInstance, and an error, if there is any. +func (c *FakeBrokerTemplateInstances) Create(brokerTemplateInstance *template_v1.BrokerTemplateInstance) (result *template_v1.BrokerTemplateInstance, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(brokertemplateinstancesResource, brokerTemplateInstance), &template_v1.BrokerTemplateInstance{}) + if obj == nil { + return nil, err + } + return obj.(*template_v1.BrokerTemplateInstance), err +} + +// Update takes the representation of a brokerTemplateInstance and updates it. Returns the server's representation of the brokerTemplateInstance, and an error, if there is any. +func (c *FakeBrokerTemplateInstances) Update(brokerTemplateInstance *template_v1.BrokerTemplateInstance) (result *template_v1.BrokerTemplateInstance, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(brokertemplateinstancesResource, brokerTemplateInstance), &template_v1.BrokerTemplateInstance{}) + if obj == nil { + return nil, err + } + return obj.(*template_v1.BrokerTemplateInstance), err +} + +// Delete takes name of the brokerTemplateInstance and deletes it. Returns an error if one occurs. +func (c *FakeBrokerTemplateInstances) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(brokertemplateinstancesResource, name), &template_v1.BrokerTemplateInstance{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeBrokerTemplateInstances) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(brokertemplateinstancesResource, listOptions) + + _, err := c.Fake.Invokes(action, &template_v1.BrokerTemplateInstanceList{}) + return err +} + +// Patch applies the patch and returns the patched brokerTemplateInstance. +func (c *FakeBrokerTemplateInstances) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *template_v1.BrokerTemplateInstance, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(brokertemplateinstancesResource, name, data, subresources...), &template_v1.BrokerTemplateInstance{}) + if obj == nil { + return nil, err + } + return obj.(*template_v1.BrokerTemplateInstance), err +} diff --git a/template/clientset/versioned/typed/template/v1/fake/fake_template.go b/template/clientset/versioned/typed/template/v1/fake/fake_template.go new file mode 100644 index 0000000000..c526ac266d --- /dev/null +++ b/template/clientset/versioned/typed/template/v1/fake/fake_template.go @@ -0,0 +1,110 @@ +package fake + +import ( + template_v1 "github.com/openshift/api/template/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeTemplates implements TemplateInterface +type FakeTemplates struct { + Fake *FakeTemplateV1 + ns string +} + +var templatesResource = schema.GroupVersionResource{Group: "template.openshift.io", Version: "v1", Resource: "templates"} + +var templatesKind = schema.GroupVersionKind{Group: "template.openshift.io", Version: "v1", Kind: "Template"} + +// Get takes name of the template, and returns the corresponding template object, and an error if there is any. +func (c *FakeTemplates) Get(name string, options v1.GetOptions) (result *template_v1.Template, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(templatesResource, c.ns, name), &template_v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*template_v1.Template), err +} + +// List takes label and field selectors, and returns the list of Templates that match those selectors. +func (c *FakeTemplates) List(opts v1.ListOptions) (result *template_v1.TemplateList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(templatesResource, templatesKind, c.ns, opts), &template_v1.TemplateList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &template_v1.TemplateList{} + for _, item := range obj.(*template_v1.TemplateList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested templates. +func (c *FakeTemplates) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(templatesResource, c.ns, opts)) + +} + +// Create takes the representation of a template and creates it. Returns the server's representation of the template, and an error, if there is any. +func (c *FakeTemplates) Create(template *template_v1.Template) (result *template_v1.Template, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(templatesResource, c.ns, template), &template_v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*template_v1.Template), err +} + +// Update takes the representation of a template and updates it. Returns the server's representation of the template, and an error, if there is any. +func (c *FakeTemplates) Update(template *template_v1.Template) (result *template_v1.Template, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(templatesResource, c.ns, template), &template_v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*template_v1.Template), err +} + +// Delete takes name of the template and deletes it. Returns an error if one occurs. +func (c *FakeTemplates) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(templatesResource, c.ns, name), &template_v1.Template{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeTemplates) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(templatesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &template_v1.TemplateList{}) + return err +} + +// Patch applies the patch and returns the patched template. +func (c *FakeTemplates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *template_v1.Template, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(templatesResource, c.ns, name, data, subresources...), &template_v1.Template{}) + + if obj == nil { + return nil, err + } + return obj.(*template_v1.Template), err +} diff --git a/template/clientset/versioned/typed/template/v1/fake/fake_template_client.go b/template/clientset/versioned/typed/template/v1/fake/fake_template_client.go new file mode 100644 index 0000000000..bca7c8fa3f --- /dev/null +++ b/template/clientset/versioned/typed/template/v1/fake/fake_template_client.go @@ -0,0 +1,30 @@ +package fake + +import ( + v1 "github.com/openshift/client-go/template/clientset/versioned/typed/template/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeTemplateV1 struct { + *testing.Fake +} + +func (c *FakeTemplateV1) BrokerTemplateInstances() v1.BrokerTemplateInstanceInterface { + return &FakeBrokerTemplateInstances{c} +} + +func (c *FakeTemplateV1) Templates(namespace string) v1.TemplateInterface { + return &FakeTemplates{c, namespace} +} + +func (c *FakeTemplateV1) TemplateInstances(namespace string) v1.TemplateInstanceInterface { + return &FakeTemplateInstances{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeTemplateV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/template/clientset/versioned/typed/template/v1/fake/fake_templateinstance.go b/template/clientset/versioned/typed/template/v1/fake/fake_templateinstance.go new file mode 100644 index 0000000000..94228263fa --- /dev/null +++ b/template/clientset/versioned/typed/template/v1/fake/fake_templateinstance.go @@ -0,0 +1,122 @@ +package fake + +import ( + template_v1 "github.com/openshift/api/template/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeTemplateInstances implements TemplateInstanceInterface +type FakeTemplateInstances struct { + Fake *FakeTemplateV1 + ns string +} + +var templateinstancesResource = schema.GroupVersionResource{Group: "template.openshift.io", Version: "v1", Resource: "templateinstances"} + +var templateinstancesKind = schema.GroupVersionKind{Group: "template.openshift.io", Version: "v1", Kind: "TemplateInstance"} + +// Get takes name of the templateInstance, and returns the corresponding templateInstance object, and an error if there is any. +func (c *FakeTemplateInstances) Get(name string, options v1.GetOptions) (result *template_v1.TemplateInstance, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(templateinstancesResource, c.ns, name), &template_v1.TemplateInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*template_v1.TemplateInstance), err +} + +// List takes label and field selectors, and returns the list of TemplateInstances that match those selectors. +func (c *FakeTemplateInstances) List(opts v1.ListOptions) (result *template_v1.TemplateInstanceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(templateinstancesResource, templateinstancesKind, c.ns, opts), &template_v1.TemplateInstanceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &template_v1.TemplateInstanceList{} + for _, item := range obj.(*template_v1.TemplateInstanceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested templateInstances. +func (c *FakeTemplateInstances) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(templateinstancesResource, c.ns, opts)) + +} + +// Create takes the representation of a templateInstance and creates it. Returns the server's representation of the templateInstance, and an error, if there is any. +func (c *FakeTemplateInstances) Create(templateInstance *template_v1.TemplateInstance) (result *template_v1.TemplateInstance, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(templateinstancesResource, c.ns, templateInstance), &template_v1.TemplateInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*template_v1.TemplateInstance), err +} + +// Update takes the representation of a templateInstance and updates it. Returns the server's representation of the templateInstance, and an error, if there is any. +func (c *FakeTemplateInstances) Update(templateInstance *template_v1.TemplateInstance) (result *template_v1.TemplateInstance, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(templateinstancesResource, c.ns, templateInstance), &template_v1.TemplateInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*template_v1.TemplateInstance), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeTemplateInstances) UpdateStatus(templateInstance *template_v1.TemplateInstance) (*template_v1.TemplateInstance, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(templateinstancesResource, "status", c.ns, templateInstance), &template_v1.TemplateInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*template_v1.TemplateInstance), err +} + +// Delete takes name of the templateInstance and deletes it. Returns an error if one occurs. +func (c *FakeTemplateInstances) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(templateinstancesResource, c.ns, name), &template_v1.TemplateInstance{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeTemplateInstances) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(templateinstancesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &template_v1.TemplateInstanceList{}) + return err +} + +// Patch applies the patch and returns the patched templateInstance. +func (c *FakeTemplateInstances) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *template_v1.TemplateInstance, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(templateinstancesResource, c.ns, name, data, subresources...), &template_v1.TemplateInstance{}) + + if obj == nil { + return nil, err + } + return obj.(*template_v1.TemplateInstance), err +} diff --git a/template/clientset/versioned/typed/template/v1/generated_expansion.go b/template/clientset/versioned/typed/template/v1/generated_expansion.go new file mode 100644 index 0000000000..21ca30d177 --- /dev/null +++ b/template/clientset/versioned/typed/template/v1/generated_expansion.go @@ -0,0 +1,7 @@ +package v1 + +type BrokerTemplateInstanceExpansion interface{} + +type TemplateExpansion interface{} + +type TemplateInstanceExpansion interface{} diff --git a/template/clientset/versioned/typed/template/v1/template.go b/template/clientset/versioned/typed/template/v1/template.go new file mode 100644 index 0000000000..005ad761e5 --- /dev/null +++ b/template/clientset/versioned/typed/template/v1/template.go @@ -0,0 +1,139 @@ +package v1 + +import ( + v1 "github.com/openshift/api/template/v1" + scheme "github.com/openshift/client-go/template/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// TemplatesGetter has a method to return a TemplateInterface. +// A group's client should implement this interface. +type TemplatesGetter interface { + Templates(namespace string) TemplateInterface +} + +// TemplateInterface has methods to work with Template resources. +type TemplateInterface interface { + Create(*v1.Template) (*v1.Template, error) + Update(*v1.Template) (*v1.Template, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.Template, error) + List(opts meta_v1.ListOptions) (*v1.TemplateList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Template, err error) + TemplateExpansion +} + +// templates implements TemplateInterface +type templates struct { + client rest.Interface + ns string +} + +// newTemplates returns a Templates +func newTemplates(c *TemplateV1Client, namespace string) *templates { + return &templates{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the template, and returns the corresponding template object, and an error if there is any. +func (c *templates) Get(name string, options meta_v1.GetOptions) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templates"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Templates that match those selectors. +func (c *templates) List(opts meta_v1.ListOptions) (result *v1.TemplateList, err error) { + result = &v1.TemplateList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested templates. +func (c *templates) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a template and creates it. Returns the server's representation of the template, and an error, if there is any. +func (c *templates) Create(template *v1.Template) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Post(). + Namespace(c.ns). + Resource("templates"). + Body(template). + Do(). + Into(result) + return +} + +// Update takes the representation of a template and updates it. Returns the server's representation of the template, and an error, if there is any. +func (c *templates) Update(template *v1.Template) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Put(). + Namespace(c.ns). + Resource("templates"). + Name(template.Name). + Body(template). + Do(). + Into(result) + return +} + +// Delete takes name of the template and deletes it. Returns an error if one occurs. +func (c *templates) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("templates"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *templates) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("templates"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched template. +func (c *templates) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Template, err error) { + result = &v1.Template{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("templates"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/template/clientset/versioned/typed/template/v1/template_client.go b/template/clientset/versioned/typed/template/v1/template_client.go new file mode 100644 index 0000000000..992bab7d6a --- /dev/null +++ b/template/clientset/versioned/typed/template/v1/template_client.go @@ -0,0 +1,82 @@ +package v1 + +import ( + v1 "github.com/openshift/api/template/v1" + "github.com/openshift/client-go/template/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type TemplateV1Interface interface { + RESTClient() rest.Interface + BrokerTemplateInstancesGetter + TemplatesGetter + TemplateInstancesGetter +} + +// TemplateV1Client is used to interact with features provided by the template.openshift.io group. +type TemplateV1Client struct { + restClient rest.Interface +} + +func (c *TemplateV1Client) BrokerTemplateInstances() BrokerTemplateInstanceInterface { + return newBrokerTemplateInstances(c) +} + +func (c *TemplateV1Client) Templates(namespace string) TemplateInterface { + return newTemplates(c, namespace) +} + +func (c *TemplateV1Client) TemplateInstances(namespace string) TemplateInstanceInterface { + return newTemplateInstances(c, namespace) +} + +// NewForConfig creates a new TemplateV1Client for the given config. +func NewForConfig(c *rest.Config) (*TemplateV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &TemplateV1Client{client}, nil +} + +// NewForConfigOrDie creates a new TemplateV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *TemplateV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new TemplateV1Client for the given RESTClient. +func New(c rest.Interface) *TemplateV1Client { + return &TemplateV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *TemplateV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/template/clientset/versioned/typed/template/v1/templateinstance.go b/template/clientset/versioned/typed/template/v1/templateinstance.go new file mode 100644 index 0000000000..816c76f592 --- /dev/null +++ b/template/clientset/versioned/typed/template/v1/templateinstance.go @@ -0,0 +1,156 @@ +package v1 + +import ( + v1 "github.com/openshift/api/template/v1" + scheme "github.com/openshift/client-go/template/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// TemplateInstancesGetter has a method to return a TemplateInstanceInterface. +// A group's client should implement this interface. +type TemplateInstancesGetter interface { + TemplateInstances(namespace string) TemplateInstanceInterface +} + +// TemplateInstanceInterface has methods to work with TemplateInstance resources. +type TemplateInstanceInterface interface { + Create(*v1.TemplateInstance) (*v1.TemplateInstance, error) + Update(*v1.TemplateInstance) (*v1.TemplateInstance, error) + UpdateStatus(*v1.TemplateInstance) (*v1.TemplateInstance, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.TemplateInstance, error) + List(opts meta_v1.ListOptions) (*v1.TemplateInstanceList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.TemplateInstance, err error) + TemplateInstanceExpansion +} + +// templateInstances implements TemplateInstanceInterface +type templateInstances struct { + client rest.Interface + ns string +} + +// newTemplateInstances returns a TemplateInstances +func newTemplateInstances(c *TemplateV1Client, namespace string) *templateInstances { + return &templateInstances{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the templateInstance, and returns the corresponding templateInstance object, and an error if there is any. +func (c *templateInstances) Get(name string, options meta_v1.GetOptions) (result *v1.TemplateInstance, err error) { + result = &v1.TemplateInstance{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templateinstances"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of TemplateInstances that match those selectors. +func (c *templateInstances) List(opts meta_v1.ListOptions) (result *v1.TemplateInstanceList, err error) { + result = &v1.TemplateInstanceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("templateinstances"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested templateInstances. +func (c *templateInstances) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("templateinstances"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a templateInstance and creates it. Returns the server's representation of the templateInstance, and an error, if there is any. +func (c *templateInstances) Create(templateInstance *v1.TemplateInstance) (result *v1.TemplateInstance, err error) { + result = &v1.TemplateInstance{} + err = c.client.Post(). + Namespace(c.ns). + Resource("templateinstances"). + Body(templateInstance). + Do(). + Into(result) + return +} + +// Update takes the representation of a templateInstance and updates it. Returns the server's representation of the templateInstance, and an error, if there is any. +func (c *templateInstances) Update(templateInstance *v1.TemplateInstance) (result *v1.TemplateInstance, err error) { + result = &v1.TemplateInstance{} + err = c.client.Put(). + Namespace(c.ns). + Resource("templateinstances"). + Name(templateInstance.Name). + Body(templateInstance). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *templateInstances) UpdateStatus(templateInstance *v1.TemplateInstance) (result *v1.TemplateInstance, err error) { + result = &v1.TemplateInstance{} + err = c.client.Put(). + Namespace(c.ns). + Resource("templateinstances"). + Name(templateInstance.Name). + SubResource("status"). + Body(templateInstance). + Do(). + Into(result) + return +} + +// Delete takes name of the templateInstance and deletes it. Returns an error if one occurs. +func (c *templateInstances) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("templateinstances"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *templateInstances) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("templateinstances"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched templateInstance. +func (c *templateInstances) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.TemplateInstance, err error) { + result = &v1.TemplateInstance{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("templateinstances"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/template/informers/externalversions/factory.go b/template/informers/externalversions/factory.go new file mode 100644 index 0000000000..6150ccf037 --- /dev/null +++ b/template/informers/externalversions/factory.go @@ -0,0 +1,102 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + versioned "github.com/openshift/client-go/template/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/template/informers/externalversions/internalinterfaces" + template "github.com/openshift/client-go/template/informers/externalversions/template" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + reflect "reflect" + sync "sync" + time "time" +) + +type sharedInformerFactory struct { + client versioned.Interface + lock sync.Mutex + defaultResync time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return &sharedInformerFactory{ + client: client, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + } +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + informer = newFunc(f.client, f.defaultResync) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Template() template.Interface +} + +func (f *sharedInformerFactory) Template() template.Interface { + return template.New(f) +} diff --git a/template/informers/externalversions/generic.go b/template/informers/externalversions/generic.go new file mode 100644 index 0000000000..057e98162c --- /dev/null +++ b/template/informers/externalversions/generic.go @@ -0,0 +1,49 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + "fmt" + v1 "github.com/openshift/api/template/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=Template, Version=V1 + case v1.SchemeGroupVersion.WithResource("brokertemplateinstances"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Template().V1().BrokerTemplateInstances().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("templates"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Template().V1().Templates().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("templateinstances"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Template().V1().TemplateInstances().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/template/informers/externalversions/internalinterfaces/factory_interfaces.go b/template/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..ea35978dff --- /dev/null +++ b/template/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,18 @@ +// This file was automatically generated by informer-gen + +package internalinterfaces + +import ( + versioned "github.com/openshift/client-go/template/clientset/versioned" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} diff --git a/template/informers/externalversions/template/interface.go b/template/informers/externalversions/template/interface.go new file mode 100644 index 0000000000..e1681bdae2 --- /dev/null +++ b/template/informers/externalversions/template/interface.go @@ -0,0 +1,28 @@ +// This file was automatically generated by informer-gen + +package template + +import ( + internalinterfaces "github.com/openshift/client-go/template/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/template/informers/externalversions/template/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &group{f} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.SharedInformerFactory) +} diff --git a/template/informers/externalversions/template/v1/brokertemplateinstance.go b/template/informers/externalversions/template/v1/brokertemplateinstance.go new file mode 100644 index 0000000000..52c596919d --- /dev/null +++ b/template/informers/externalversions/template/v1/brokertemplateinstance.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + template_v1 "github.com/openshift/api/template/v1" + versioned "github.com/openshift/client-go/template/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/template/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/template/listers/template/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// BrokerTemplateInstanceInformer provides access to a shared informer and lister for +// BrokerTemplateInstances. +type BrokerTemplateInstanceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.BrokerTemplateInstanceLister +} + +type brokerTemplateInstanceInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewBrokerTemplateInstanceInformer constructs a new informer for BrokerTemplateInstance type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewBrokerTemplateInstanceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.TemplateV1().BrokerTemplateInstances().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.TemplateV1().BrokerTemplateInstances().Watch(options) + }, + }, + &template_v1.BrokerTemplateInstance{}, + resyncPeriod, + indexers, + ) +} + +func defaultBrokerTemplateInstanceInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewBrokerTemplateInstanceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *brokerTemplateInstanceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&template_v1.BrokerTemplateInstance{}, defaultBrokerTemplateInstanceInformer) +} + +func (f *brokerTemplateInstanceInformer) Lister() v1.BrokerTemplateInstanceLister { + return v1.NewBrokerTemplateInstanceLister(f.Informer().GetIndexer()) +} diff --git a/template/informers/externalversions/template/v1/interface.go b/template/informers/externalversions/template/v1/interface.go new file mode 100644 index 0000000000..4ab5fb2dbd --- /dev/null +++ b/template/informers/externalversions/template/v1/interface.go @@ -0,0 +1,41 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + internalinterfaces "github.com/openshift/client-go/template/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // BrokerTemplateInstances returns a BrokerTemplateInstanceInformer. + BrokerTemplateInstances() BrokerTemplateInstanceInformer + // Templates returns a TemplateInformer. + Templates() TemplateInformer + // TemplateInstances returns a TemplateInstanceInformer. + TemplateInstances() TemplateInstanceInformer +} + +type version struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &version{f} +} + +// BrokerTemplateInstances returns a BrokerTemplateInstanceInformer. +func (v *version) BrokerTemplateInstances() BrokerTemplateInstanceInformer { + return &brokerTemplateInstanceInformer{factory: v.SharedInformerFactory} +} + +// Templates returns a TemplateInformer. +func (v *version) Templates() TemplateInformer { + return &templateInformer{factory: v.SharedInformerFactory} +} + +// TemplateInstances returns a TemplateInstanceInformer. +func (v *version) TemplateInstances() TemplateInstanceInformer { + return &templateInstanceInformer{factory: v.SharedInformerFactory} +} diff --git a/template/informers/externalversions/template/v1/template.go b/template/informers/externalversions/template/v1/template.go new file mode 100644 index 0000000000..fe4379226d --- /dev/null +++ b/template/informers/externalversions/template/v1/template.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + template_v1 "github.com/openshift/api/template/v1" + versioned "github.com/openshift/client-go/template/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/template/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/template/listers/template/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// TemplateInformer provides access to a shared informer and lister for +// Templates. +type TemplateInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.TemplateLister +} + +type templateInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewTemplateInformer constructs a new informer for Template type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTemplateInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.TemplateV1().Templates(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.TemplateV1().Templates(namespace).Watch(options) + }, + }, + &template_v1.Template{}, + resyncPeriod, + indexers, + ) +} + +func defaultTemplateInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewTemplateInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *templateInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&template_v1.Template{}, defaultTemplateInformer) +} + +func (f *templateInformer) Lister() v1.TemplateLister { + return v1.NewTemplateLister(f.Informer().GetIndexer()) +} diff --git a/template/informers/externalversions/template/v1/templateinstance.go b/template/informers/externalversions/template/v1/templateinstance.go new file mode 100644 index 0000000000..1010aaddb2 --- /dev/null +++ b/template/informers/externalversions/template/v1/templateinstance.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + template_v1 "github.com/openshift/api/template/v1" + versioned "github.com/openshift/client-go/template/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/template/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/template/listers/template/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// TemplateInstanceInformer provides access to a shared informer and lister for +// TemplateInstances. +type TemplateInstanceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.TemplateInstanceLister +} + +type templateInstanceInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewTemplateInstanceInformer constructs a new informer for TemplateInstance type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTemplateInstanceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.TemplateV1().TemplateInstances(namespace).List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.TemplateV1().TemplateInstances(namespace).Watch(options) + }, + }, + &template_v1.TemplateInstance{}, + resyncPeriod, + indexers, + ) +} + +func defaultTemplateInstanceInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewTemplateInstanceInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *templateInstanceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&template_v1.TemplateInstance{}, defaultTemplateInstanceInformer) +} + +func (f *templateInstanceInformer) Lister() v1.TemplateInstanceLister { + return v1.NewTemplateInstanceLister(f.Informer().GetIndexer()) +} diff --git a/template/listers/template/v1/brokertemplateinstance.go b/template/listers/template/v1/brokertemplateinstance.go new file mode 100644 index 0000000000..eae3898810 --- /dev/null +++ b/template/listers/template/v1/brokertemplateinstance.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/template/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// BrokerTemplateInstanceLister helps list BrokerTemplateInstances. +type BrokerTemplateInstanceLister interface { + // List lists all BrokerTemplateInstances in the indexer. + List(selector labels.Selector) (ret []*v1.BrokerTemplateInstance, err error) + // Get retrieves the BrokerTemplateInstance from the index for a given name. + Get(name string) (*v1.BrokerTemplateInstance, error) + BrokerTemplateInstanceListerExpansion +} + +// brokerTemplateInstanceLister implements the BrokerTemplateInstanceLister interface. +type brokerTemplateInstanceLister struct { + indexer cache.Indexer +} + +// NewBrokerTemplateInstanceLister returns a new BrokerTemplateInstanceLister. +func NewBrokerTemplateInstanceLister(indexer cache.Indexer) BrokerTemplateInstanceLister { + return &brokerTemplateInstanceLister{indexer: indexer} +} + +// List lists all BrokerTemplateInstances in the indexer. +func (s *brokerTemplateInstanceLister) List(selector labels.Selector) (ret []*v1.BrokerTemplateInstance, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.BrokerTemplateInstance)) + }) + return ret, err +} + +// Get retrieves the BrokerTemplateInstance from the index for a given name. +func (s *brokerTemplateInstanceLister) Get(name string) (*v1.BrokerTemplateInstance, error) { + key := &v1.BrokerTemplateInstance{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("brokertemplateinstance"), name) + } + return obj.(*v1.BrokerTemplateInstance), nil +} diff --git a/template/listers/template/v1/expansion_generated.go b/template/listers/template/v1/expansion_generated.go new file mode 100644 index 0000000000..324d62ca97 --- /dev/null +++ b/template/listers/template/v1/expansion_generated.go @@ -0,0 +1,23 @@ +// This file was automatically generated by lister-gen + +package v1 + +// BrokerTemplateInstanceListerExpansion allows custom methods to be added to +// BrokerTemplateInstanceLister. +type BrokerTemplateInstanceListerExpansion interface{} + +// TemplateListerExpansion allows custom methods to be added to +// TemplateLister. +type TemplateListerExpansion interface{} + +// TemplateNamespaceListerExpansion allows custom methods to be added to +// TemplateNamespaceLister. +type TemplateNamespaceListerExpansion interface{} + +// TemplateInstanceListerExpansion allows custom methods to be added to +// TemplateInstanceLister. +type TemplateInstanceListerExpansion interface{} + +// TemplateInstanceNamespaceListerExpansion allows custom methods to be added to +// TemplateInstanceNamespaceLister. +type TemplateInstanceNamespaceListerExpansion interface{} diff --git a/template/listers/template/v1/template.go b/template/listers/template/v1/template.go new file mode 100644 index 0000000000..427df26b80 --- /dev/null +++ b/template/listers/template/v1/template.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/template/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// TemplateLister helps list Templates. +type TemplateLister interface { + // List lists all Templates in the indexer. + List(selector labels.Selector) (ret []*v1.Template, err error) + // Templates returns an object that can list and get Templates. + Templates(namespace string) TemplateNamespaceLister + TemplateListerExpansion +} + +// templateLister implements the TemplateLister interface. +type templateLister struct { + indexer cache.Indexer +} + +// NewTemplateLister returns a new TemplateLister. +func NewTemplateLister(indexer cache.Indexer) TemplateLister { + return &templateLister{indexer: indexer} +} + +// List lists all Templates in the indexer. +func (s *templateLister) List(selector labels.Selector) (ret []*v1.Template, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Template)) + }) + return ret, err +} + +// Templates returns an object that can list and get Templates. +func (s *templateLister) Templates(namespace string) TemplateNamespaceLister { + return templateNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// TemplateNamespaceLister helps list and get Templates. +type TemplateNamespaceLister interface { + // List lists all Templates in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.Template, err error) + // Get retrieves the Template from the indexer for a given namespace and name. + Get(name string) (*v1.Template, error) + TemplateNamespaceListerExpansion +} + +// templateNamespaceLister implements the TemplateNamespaceLister +// interface. +type templateNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Templates in the indexer for a given namespace. +func (s templateNamespaceLister) List(selector labels.Selector) (ret []*v1.Template, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Template)) + }) + return ret, err +} + +// Get retrieves the Template from the indexer for a given namespace and name. +func (s templateNamespaceLister) Get(name string) (*v1.Template, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("template"), name) + } + return obj.(*v1.Template), nil +} diff --git a/template/listers/template/v1/templateinstance.go b/template/listers/template/v1/templateinstance.go new file mode 100644 index 0000000000..042d05a1fe --- /dev/null +++ b/template/listers/template/v1/templateinstance.go @@ -0,0 +1,78 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/template/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// TemplateInstanceLister helps list TemplateInstances. +type TemplateInstanceLister interface { + // List lists all TemplateInstances in the indexer. + List(selector labels.Selector) (ret []*v1.TemplateInstance, err error) + // TemplateInstances returns an object that can list and get TemplateInstances. + TemplateInstances(namespace string) TemplateInstanceNamespaceLister + TemplateInstanceListerExpansion +} + +// templateInstanceLister implements the TemplateInstanceLister interface. +type templateInstanceLister struct { + indexer cache.Indexer +} + +// NewTemplateInstanceLister returns a new TemplateInstanceLister. +func NewTemplateInstanceLister(indexer cache.Indexer) TemplateInstanceLister { + return &templateInstanceLister{indexer: indexer} +} + +// List lists all TemplateInstances in the indexer. +func (s *templateInstanceLister) List(selector labels.Selector) (ret []*v1.TemplateInstance, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.TemplateInstance)) + }) + return ret, err +} + +// TemplateInstances returns an object that can list and get TemplateInstances. +func (s *templateInstanceLister) TemplateInstances(namespace string) TemplateInstanceNamespaceLister { + return templateInstanceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// TemplateInstanceNamespaceLister helps list and get TemplateInstances. +type TemplateInstanceNamespaceLister interface { + // List lists all TemplateInstances in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.TemplateInstance, err error) + // Get retrieves the TemplateInstance from the indexer for a given namespace and name. + Get(name string) (*v1.TemplateInstance, error) + TemplateInstanceNamespaceListerExpansion +} + +// templateInstanceNamespaceLister implements the TemplateInstanceNamespaceLister +// interface. +type templateInstanceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all TemplateInstances in the indexer for a given namespace. +func (s templateInstanceNamespaceLister) List(selector labels.Selector) (ret []*v1.TemplateInstance, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.TemplateInstance)) + }) + return ret, err +} + +// Get retrieves the TemplateInstance from the indexer for a given namespace and name. +func (s templateInstanceNamespaceLister) Get(name string) (*v1.TemplateInstance, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("templateinstance"), name) + } + return obj.(*v1.TemplateInstance), nil +} diff --git a/user/clientset/versioned/clientset.go b/user/clientset/versioned/clientset.go new file mode 100644 index 0000000000..ec5655db83 --- /dev/null +++ b/user/clientset/versioned/clientset.go @@ -0,0 +1,82 @@ +package versioned + +import ( + glog "github.com/golang/glog" + userv1 "github.com/openshift/client-go/user/clientset/versioned/typed/user/v1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + UserV1() userv1.UserV1Interface + // Deprecated: please explicitly pick a version if possible. + User() userv1.UserV1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + userV1 *userv1.UserV1Client +} + +// UserV1 retrieves the UserV1Client +func (c *Clientset) UserV1() userv1.UserV1Interface { + return c.userV1 +} + +// Deprecated: User retrieves the default version of UserClient. +// Please explicitly pick a version. +func (c *Clientset) User() userv1.UserV1Interface { + return c.userV1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.userV1, err = userv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + glog.Errorf("failed to create the DiscoveryClient: %v", err) + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.userV1 = userv1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.userV1 = userv1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/user/clientset/versioned/doc.go b/user/clientset/versioned/doc.go new file mode 100644 index 0000000000..72f92921e6 --- /dev/null +++ b/user/clientset/versioned/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated clientset. +package versioned diff --git a/user/clientset/versioned/fake/clientset_generated.go b/user/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..6d73e82406 --- /dev/null +++ b/user/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,55 @@ +package fake + +import ( + clientset "github.com/openshift/client-go/user/clientset/versioned" + userv1 "github.com/openshift/client-go/user/clientset/versioned/typed/user/v1" + fakeuserv1 "github.com/openshift/client-go/user/clientset/versioned/typed/user/v1/fake" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + fakePtr := testing.Fake{} + fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) + fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) + + return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +var _ clientset.Interface = &Clientset{} + +// UserV1 retrieves the UserV1Client +func (c *Clientset) UserV1() userv1.UserV1Interface { + return &fakeuserv1.FakeUserV1{Fake: &c.Fake} +} + +// User retrieves the UserV1Client +func (c *Clientset) User() userv1.UserV1Interface { + return &fakeuserv1.FakeUserV1{Fake: &c.Fake} +} diff --git a/user/clientset/versioned/fake/doc.go b/user/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..760aaa8253 --- /dev/null +++ b/user/clientset/versioned/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated fake clientset. +package fake diff --git a/user/clientset/versioned/fake/register.go b/user/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..d8a8a31672 --- /dev/null +++ b/user/clientset/versioned/fake/register.go @@ -0,0 +1,37 @@ +package fake + +import ( + userv1 "github.com/openshift/api/user/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) +var parameterCodec = runtime.NewParameterCodec(scheme) + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + userv1.AddToScheme(scheme) + +} diff --git a/user/clientset/versioned/scheme/doc.go b/user/clientset/versioned/scheme/doc.go new file mode 100644 index 0000000000..d1c53d03b2 --- /dev/null +++ b/user/clientset/versioned/scheme/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/user/clientset/versioned/scheme/register.go b/user/clientset/versioned/scheme/register.go new file mode 100644 index 0000000000..34f5afa10c --- /dev/null +++ b/user/clientset/versioned/scheme/register.go @@ -0,0 +1,37 @@ +package scheme + +import ( + userv1 "github.com/openshift/api/user/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + AddToScheme(Scheme) +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +func AddToScheme(scheme *runtime.Scheme) { + userv1.AddToScheme(scheme) + +} diff --git a/user/clientset/versioned/typed/user/v1/doc.go b/user/clientset/versioned/typed/user/v1/doc.go new file mode 100644 index 0000000000..0e93c2c5e7 --- /dev/null +++ b/user/clientset/versioned/typed/user/v1/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// This package has the automatically generated typed clients. +package v1 diff --git a/user/clientset/versioned/typed/user/v1/fake/doc.go b/user/clientset/versioned/typed/user/v1/fake/doc.go new file mode 100644 index 0000000000..e3bbd12a2b --- /dev/null +++ b/user/clientset/versioned/typed/user/v1/fake/doc.go @@ -0,0 +1,4 @@ +// This package is generated by client-gen with custom arguments. + +// Package fake has the automatically generated clients. +package fake diff --git a/user/clientset/versioned/typed/user/v1/fake/fake_group.go b/user/clientset/versioned/typed/user/v1/fake/fake_group.go new file mode 100644 index 0000000000..1241802148 --- /dev/null +++ b/user/clientset/versioned/typed/user/v1/fake/fake_group.go @@ -0,0 +1,102 @@ +package fake + +import ( + user_v1 "github.com/openshift/api/user/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeGroups implements GroupInterface +type FakeGroups struct { + Fake *FakeUserV1 +} + +var groupsResource = schema.GroupVersionResource{Group: "user.openshift.io", Version: "v1", Resource: "groups"} + +var groupsKind = schema.GroupVersionKind{Group: "user.openshift.io", Version: "v1", Kind: "Group"} + +// Get takes name of the group, and returns the corresponding group object, and an error if there is any. +func (c *FakeGroups) Get(name string, options v1.GetOptions) (result *user_v1.Group, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(groupsResource, name), &user_v1.Group{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.Group), err +} + +// List takes label and field selectors, and returns the list of Groups that match those selectors. +func (c *FakeGroups) List(opts v1.ListOptions) (result *user_v1.GroupList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(groupsResource, groupsKind, opts), &user_v1.GroupList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &user_v1.GroupList{} + for _, item := range obj.(*user_v1.GroupList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested groups. +func (c *FakeGroups) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(groupsResource, opts)) +} + +// Create takes the representation of a group and creates it. Returns the server's representation of the group, and an error, if there is any. +func (c *FakeGroups) Create(group *user_v1.Group) (result *user_v1.Group, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(groupsResource, group), &user_v1.Group{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.Group), err +} + +// Update takes the representation of a group and updates it. Returns the server's representation of the group, and an error, if there is any. +func (c *FakeGroups) Update(group *user_v1.Group) (result *user_v1.Group, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(groupsResource, group), &user_v1.Group{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.Group), err +} + +// Delete takes name of the group and deletes it. Returns an error if one occurs. +func (c *FakeGroups) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(groupsResource, name), &user_v1.Group{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeGroups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(groupsResource, listOptions) + + _, err := c.Fake.Invokes(action, &user_v1.GroupList{}) + return err +} + +// Patch applies the patch and returns the patched group. +func (c *FakeGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *user_v1.Group, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(groupsResource, name, data, subresources...), &user_v1.Group{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.Group), err +} diff --git a/user/clientset/versioned/typed/user/v1/fake/fake_identity.go b/user/clientset/versioned/typed/user/v1/fake/fake_identity.go new file mode 100644 index 0000000000..8e984b06d1 --- /dev/null +++ b/user/clientset/versioned/typed/user/v1/fake/fake_identity.go @@ -0,0 +1,102 @@ +package fake + +import ( + user_v1 "github.com/openshift/api/user/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeIdentities implements IdentityInterface +type FakeIdentities struct { + Fake *FakeUserV1 +} + +var identitiesResource = schema.GroupVersionResource{Group: "user.openshift.io", Version: "v1", Resource: "identities"} + +var identitiesKind = schema.GroupVersionKind{Group: "user.openshift.io", Version: "v1", Kind: "Identity"} + +// Get takes name of the identity, and returns the corresponding identity object, and an error if there is any. +func (c *FakeIdentities) Get(name string, options v1.GetOptions) (result *user_v1.Identity, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(identitiesResource, name), &user_v1.Identity{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.Identity), err +} + +// List takes label and field selectors, and returns the list of Identities that match those selectors. +func (c *FakeIdentities) List(opts v1.ListOptions) (result *user_v1.IdentityList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(identitiesResource, identitiesKind, opts), &user_v1.IdentityList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &user_v1.IdentityList{} + for _, item := range obj.(*user_v1.IdentityList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested identities. +func (c *FakeIdentities) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(identitiesResource, opts)) +} + +// Create takes the representation of a identity and creates it. Returns the server's representation of the identity, and an error, if there is any. +func (c *FakeIdentities) Create(identity *user_v1.Identity) (result *user_v1.Identity, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(identitiesResource, identity), &user_v1.Identity{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.Identity), err +} + +// Update takes the representation of a identity and updates it. Returns the server's representation of the identity, and an error, if there is any. +func (c *FakeIdentities) Update(identity *user_v1.Identity) (result *user_v1.Identity, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(identitiesResource, identity), &user_v1.Identity{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.Identity), err +} + +// Delete takes name of the identity and deletes it. Returns an error if one occurs. +func (c *FakeIdentities) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(identitiesResource, name), &user_v1.Identity{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeIdentities) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(identitiesResource, listOptions) + + _, err := c.Fake.Invokes(action, &user_v1.IdentityList{}) + return err +} + +// Patch applies the patch and returns the patched identity. +func (c *FakeIdentities) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *user_v1.Identity, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(identitiesResource, name, data, subresources...), &user_v1.Identity{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.Identity), err +} diff --git a/user/clientset/versioned/typed/user/v1/fake/fake_user.go b/user/clientset/versioned/typed/user/v1/fake/fake_user.go new file mode 100644 index 0000000000..4690a1725b --- /dev/null +++ b/user/clientset/versioned/typed/user/v1/fake/fake_user.go @@ -0,0 +1,102 @@ +package fake + +import ( + user_v1 "github.com/openshift/api/user/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeUsers implements UserInterface +type FakeUsers struct { + Fake *FakeUserV1 +} + +var usersResource = schema.GroupVersionResource{Group: "user.openshift.io", Version: "v1", Resource: "users"} + +var usersKind = schema.GroupVersionKind{Group: "user.openshift.io", Version: "v1", Kind: "User"} + +// Get takes name of the user, and returns the corresponding user object, and an error if there is any. +func (c *FakeUsers) Get(name string, options v1.GetOptions) (result *user_v1.User, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(usersResource, name), &user_v1.User{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.User), err +} + +// List takes label and field selectors, and returns the list of Users that match those selectors. +func (c *FakeUsers) List(opts v1.ListOptions) (result *user_v1.UserList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(usersResource, usersKind, opts), &user_v1.UserList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &user_v1.UserList{} + for _, item := range obj.(*user_v1.UserList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested users. +func (c *FakeUsers) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(usersResource, opts)) +} + +// Create takes the representation of a user and creates it. Returns the server's representation of the user, and an error, if there is any. +func (c *FakeUsers) Create(user *user_v1.User) (result *user_v1.User, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(usersResource, user), &user_v1.User{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.User), err +} + +// Update takes the representation of a user and updates it. Returns the server's representation of the user, and an error, if there is any. +func (c *FakeUsers) Update(user *user_v1.User) (result *user_v1.User, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(usersResource, user), &user_v1.User{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.User), err +} + +// Delete takes name of the user and deletes it. Returns an error if one occurs. +func (c *FakeUsers) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(usersResource, name), &user_v1.User{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeUsers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(usersResource, listOptions) + + _, err := c.Fake.Invokes(action, &user_v1.UserList{}) + return err +} + +// Patch applies the patch and returns the patched user. +func (c *FakeUsers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *user_v1.User, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(usersResource, name, data, subresources...), &user_v1.User{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.User), err +} diff --git a/user/clientset/versioned/typed/user/v1/fake/fake_user_client.go b/user/clientset/versioned/typed/user/v1/fake/fake_user_client.go new file mode 100644 index 0000000000..6d55cf1adf --- /dev/null +++ b/user/clientset/versioned/typed/user/v1/fake/fake_user_client.go @@ -0,0 +1,34 @@ +package fake + +import ( + v1 "github.com/openshift/client-go/user/clientset/versioned/typed/user/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeUserV1 struct { + *testing.Fake +} + +func (c *FakeUserV1) Groups() v1.GroupInterface { + return &FakeGroups{c} +} + +func (c *FakeUserV1) Identities() v1.IdentityInterface { + return &FakeIdentities{c} +} + +func (c *FakeUserV1) Users() v1.UserInterface { + return &FakeUsers{c} +} + +func (c *FakeUserV1) UserIdentityMappings() v1.UserIdentityMappingInterface { + return &FakeUserIdentityMappings{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeUserV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/user/clientset/versioned/typed/user/v1/fake/fake_useridentitymapping.go b/user/clientset/versioned/typed/user/v1/fake/fake_useridentitymapping.go new file mode 100644 index 0000000000..aa40bdd568 --- /dev/null +++ b/user/clientset/versioned/typed/user/v1/fake/fake_useridentitymapping.go @@ -0,0 +1,54 @@ +package fake + +import ( + user_v1 "github.com/openshift/api/user/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" +) + +// FakeUserIdentityMappings implements UserIdentityMappingInterface +type FakeUserIdentityMappings struct { + Fake *FakeUserV1 +} + +var useridentitymappingsResource = schema.GroupVersionResource{Group: "user.openshift.io", Version: "v1", Resource: "useridentitymappings"} + +var useridentitymappingsKind = schema.GroupVersionKind{Group: "user.openshift.io", Version: "v1", Kind: "UserIdentityMapping"} + +// Get takes name of the userIdentityMapping, and returns the corresponding userIdentityMapping object, and an error if there is any. +func (c *FakeUserIdentityMappings) Get(name string, options v1.GetOptions) (result *user_v1.UserIdentityMapping, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(useridentitymappingsResource, name), &user_v1.UserIdentityMapping{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.UserIdentityMapping), err +} + +// Create takes the representation of a userIdentityMapping and creates it. Returns the server's representation of the userIdentityMapping, and an error, if there is any. +func (c *FakeUserIdentityMappings) Create(userIdentityMapping *user_v1.UserIdentityMapping) (result *user_v1.UserIdentityMapping, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(useridentitymappingsResource, userIdentityMapping), &user_v1.UserIdentityMapping{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.UserIdentityMapping), err +} + +// Update takes the representation of a userIdentityMapping and updates it. Returns the server's representation of the userIdentityMapping, and an error, if there is any. +func (c *FakeUserIdentityMappings) Update(userIdentityMapping *user_v1.UserIdentityMapping) (result *user_v1.UserIdentityMapping, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(useridentitymappingsResource, userIdentityMapping), &user_v1.UserIdentityMapping{}) + if obj == nil { + return nil, err + } + return obj.(*user_v1.UserIdentityMapping), err +} + +// Delete takes name of the userIdentityMapping and deletes it. Returns an error if one occurs. +func (c *FakeUserIdentityMappings) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteAction(useridentitymappingsResource, name), &user_v1.UserIdentityMapping{}) + return err +} diff --git a/user/clientset/versioned/typed/user/v1/generated_expansion.go b/user/clientset/versioned/typed/user/v1/generated_expansion.go new file mode 100644 index 0000000000..e81a08ea84 --- /dev/null +++ b/user/clientset/versioned/typed/user/v1/generated_expansion.go @@ -0,0 +1,9 @@ +package v1 + +type GroupExpansion interface{} + +type IdentityExpansion interface{} + +type UserExpansion interface{} + +type UserIdentityMappingExpansion interface{} diff --git a/user/clientset/versioned/typed/user/v1/group.go b/user/clientset/versioned/typed/user/v1/group.go new file mode 100644 index 0000000000..451ea89663 --- /dev/null +++ b/user/clientset/versioned/typed/user/v1/group.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/user/v1" + scheme "github.com/openshift/client-go/user/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// GroupsGetter has a method to return a GroupInterface. +// A group's client should implement this interface. +type GroupsGetter interface { + Groups() GroupInterface +} + +// GroupInterface has methods to work with Group resources. +type GroupInterface interface { + Create(*v1.Group) (*v1.Group, error) + Update(*v1.Group) (*v1.Group, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.Group, error) + List(opts meta_v1.ListOptions) (*v1.GroupList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Group, err error) + GroupExpansion +} + +// groups implements GroupInterface +type groups struct { + client rest.Interface +} + +// newGroups returns a Groups +func newGroups(c *UserV1Client) *groups { + return &groups{ + client: c.RESTClient(), + } +} + +// Get takes name of the group, and returns the corresponding group object, and an error if there is any. +func (c *groups) Get(name string, options meta_v1.GetOptions) (result *v1.Group, err error) { + result = &v1.Group{} + err = c.client.Get(). + Resource("groups"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Groups that match those selectors. +func (c *groups) List(opts meta_v1.ListOptions) (result *v1.GroupList, err error) { + result = &v1.GroupList{} + err = c.client.Get(). + Resource("groups"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested groups. +func (c *groups) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("groups"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a group and creates it. Returns the server's representation of the group, and an error, if there is any. +func (c *groups) Create(group *v1.Group) (result *v1.Group, err error) { + result = &v1.Group{} + err = c.client.Post(). + Resource("groups"). + Body(group). + Do(). + Into(result) + return +} + +// Update takes the representation of a group and updates it. Returns the server's representation of the group, and an error, if there is any. +func (c *groups) Update(group *v1.Group) (result *v1.Group, err error) { + result = &v1.Group{} + err = c.client.Put(). + Resource("groups"). + Name(group.Name). + Body(group). + Do(). + Into(result) + return +} + +// Delete takes name of the group and deletes it. Returns an error if one occurs. +func (c *groups) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("groups"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *groups) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("groups"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched group. +func (c *groups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Group, err error) { + result = &v1.Group{} + err = c.client.Patch(pt). + Resource("groups"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/user/clientset/versioned/typed/user/v1/identity.go b/user/clientset/versioned/typed/user/v1/identity.go new file mode 100644 index 0000000000..8cc64b9d5c --- /dev/null +++ b/user/clientset/versioned/typed/user/v1/identity.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/user/v1" + scheme "github.com/openshift/client-go/user/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// IdentitiesGetter has a method to return a IdentityInterface. +// A group's client should implement this interface. +type IdentitiesGetter interface { + Identities() IdentityInterface +} + +// IdentityInterface has methods to work with Identity resources. +type IdentityInterface interface { + Create(*v1.Identity) (*v1.Identity, error) + Update(*v1.Identity) (*v1.Identity, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.Identity, error) + List(opts meta_v1.ListOptions) (*v1.IdentityList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Identity, err error) + IdentityExpansion +} + +// identities implements IdentityInterface +type identities struct { + client rest.Interface +} + +// newIdentities returns a Identities +func newIdentities(c *UserV1Client) *identities { + return &identities{ + client: c.RESTClient(), + } +} + +// Get takes name of the identity, and returns the corresponding identity object, and an error if there is any. +func (c *identities) Get(name string, options meta_v1.GetOptions) (result *v1.Identity, err error) { + result = &v1.Identity{} + err = c.client.Get(). + Resource("identities"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Identities that match those selectors. +func (c *identities) List(opts meta_v1.ListOptions) (result *v1.IdentityList, err error) { + result = &v1.IdentityList{} + err = c.client.Get(). + Resource("identities"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested identities. +func (c *identities) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("identities"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a identity and creates it. Returns the server's representation of the identity, and an error, if there is any. +func (c *identities) Create(identity *v1.Identity) (result *v1.Identity, err error) { + result = &v1.Identity{} + err = c.client.Post(). + Resource("identities"). + Body(identity). + Do(). + Into(result) + return +} + +// Update takes the representation of a identity and updates it. Returns the server's representation of the identity, and an error, if there is any. +func (c *identities) Update(identity *v1.Identity) (result *v1.Identity, err error) { + result = &v1.Identity{} + err = c.client.Put(). + Resource("identities"). + Name(identity.Name). + Body(identity). + Do(). + Into(result) + return +} + +// Delete takes name of the identity and deletes it. Returns an error if one occurs. +func (c *identities) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("identities"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *identities) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("identities"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched identity. +func (c *identities) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Identity, err error) { + result = &v1.Identity{} + err = c.client.Patch(pt). + Resource("identities"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/user/clientset/versioned/typed/user/v1/user.go b/user/clientset/versioned/typed/user/v1/user.go new file mode 100644 index 0000000000..8359d65bcd --- /dev/null +++ b/user/clientset/versioned/typed/user/v1/user.go @@ -0,0 +1,129 @@ +package v1 + +import ( + v1 "github.com/openshift/api/user/v1" + scheme "github.com/openshift/client-go/user/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// UsersGetter has a method to return a UserInterface. +// A group's client should implement this interface. +type UsersGetter interface { + Users() UserInterface +} + +// UserInterface has methods to work with User resources. +type UserInterface interface { + Create(*v1.User) (*v1.User, error) + Update(*v1.User) (*v1.User, error) + Delete(name string, options *meta_v1.DeleteOptions) error + DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.User, error) + List(opts meta_v1.ListOptions) (*v1.UserList, error) + Watch(opts meta_v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.User, err error) + UserExpansion +} + +// users implements UserInterface +type users struct { + client rest.Interface +} + +// newUsers returns a Users +func newUsers(c *UserV1Client) *users { + return &users{ + client: c.RESTClient(), + } +} + +// Get takes name of the user, and returns the corresponding user object, and an error if there is any. +func (c *users) Get(name string, options meta_v1.GetOptions) (result *v1.User, err error) { + result = &v1.User{} + err = c.client.Get(). + Resource("users"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Users that match those selectors. +func (c *users) List(opts meta_v1.ListOptions) (result *v1.UserList, err error) { + result = &v1.UserList{} + err = c.client.Get(). + Resource("users"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested users. +func (c *users) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Resource("users"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a user and creates it. Returns the server's representation of the user, and an error, if there is any. +func (c *users) Create(user *v1.User) (result *v1.User, err error) { + result = &v1.User{} + err = c.client.Post(). + Resource("users"). + Body(user). + Do(). + Into(result) + return +} + +// Update takes the representation of a user and updates it. Returns the server's representation of the user, and an error, if there is any. +func (c *users) Update(user *v1.User) (result *v1.User, err error) { + result = &v1.User{} + err = c.client.Put(). + Resource("users"). + Name(user.Name). + Body(user). + Do(). + Into(result) + return +} + +// Delete takes name of the user and deletes it. Returns an error if one occurs. +func (c *users) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("users"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *users) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { + return c.client.Delete(). + Resource("users"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched user. +func (c *users) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.User, err error) { + result = &v1.User{} + err = c.client.Patch(pt). + Resource("users"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/user/clientset/versioned/typed/user/v1/user_client.go b/user/clientset/versioned/typed/user/v1/user_client.go new file mode 100644 index 0000000000..1a63a1d174 --- /dev/null +++ b/user/clientset/versioned/typed/user/v1/user_client.go @@ -0,0 +1,87 @@ +package v1 + +import ( + v1 "github.com/openshift/api/user/v1" + "github.com/openshift/client-go/user/clientset/versioned/scheme" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" +) + +type UserV1Interface interface { + RESTClient() rest.Interface + GroupsGetter + IdentitiesGetter + UsersGetter + UserIdentityMappingsGetter +} + +// UserV1Client is used to interact with features provided by the user.openshift.io group. +type UserV1Client struct { + restClient rest.Interface +} + +func (c *UserV1Client) Groups() GroupInterface { + return newGroups(c) +} + +func (c *UserV1Client) Identities() IdentityInterface { + return newIdentities(c) +} + +func (c *UserV1Client) Users() UserInterface { + return newUsers(c) +} + +func (c *UserV1Client) UserIdentityMappings() UserIdentityMappingInterface { + return newUserIdentityMappings(c) +} + +// NewForConfig creates a new UserV1Client for the given config. +func NewForConfig(c *rest.Config) (*UserV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &UserV1Client{client}, nil +} + +// NewForConfigOrDie creates a new UserV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *UserV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new UserV1Client for the given RESTClient. +func New(c rest.Interface) *UserV1Client { + return &UserV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *UserV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/user/clientset/versioned/typed/user/v1/useridentitymapping.go b/user/clientset/versioned/typed/user/v1/useridentitymapping.go new file mode 100644 index 0000000000..3e892d0d19 --- /dev/null +++ b/user/clientset/versioned/typed/user/v1/useridentitymapping.go @@ -0,0 +1,80 @@ +package v1 + +import ( + v1 "github.com/openshift/api/user/v1" + scheme "github.com/openshift/client-go/user/clientset/versioned/scheme" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + rest "k8s.io/client-go/rest" +) + +// UserIdentityMappingsGetter has a method to return a UserIdentityMappingInterface. +// A group's client should implement this interface. +type UserIdentityMappingsGetter interface { + UserIdentityMappings() UserIdentityMappingInterface +} + +// UserIdentityMappingInterface has methods to work with UserIdentityMapping resources. +type UserIdentityMappingInterface interface { + Create(*v1.UserIdentityMapping) (*v1.UserIdentityMapping, error) + Update(*v1.UserIdentityMapping) (*v1.UserIdentityMapping, error) + Delete(name string, options *meta_v1.DeleteOptions) error + Get(name string, options meta_v1.GetOptions) (*v1.UserIdentityMapping, error) + UserIdentityMappingExpansion +} + +// userIdentityMappings implements UserIdentityMappingInterface +type userIdentityMappings struct { + client rest.Interface +} + +// newUserIdentityMappings returns a UserIdentityMappings +func newUserIdentityMappings(c *UserV1Client) *userIdentityMappings { + return &userIdentityMappings{ + client: c.RESTClient(), + } +} + +// Get takes name of the userIdentityMapping, and returns the corresponding userIdentityMapping object, and an error if there is any. +func (c *userIdentityMappings) Get(name string, options meta_v1.GetOptions) (result *v1.UserIdentityMapping, err error) { + result = &v1.UserIdentityMapping{} + err = c.client.Get(). + Resource("useridentitymappings"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Create takes the representation of a userIdentityMapping and creates it. Returns the server's representation of the userIdentityMapping, and an error, if there is any. +func (c *userIdentityMappings) Create(userIdentityMapping *v1.UserIdentityMapping) (result *v1.UserIdentityMapping, err error) { + result = &v1.UserIdentityMapping{} + err = c.client.Post(). + Resource("useridentitymappings"). + Body(userIdentityMapping). + Do(). + Into(result) + return +} + +// Update takes the representation of a userIdentityMapping and updates it. Returns the server's representation of the userIdentityMapping, and an error, if there is any. +func (c *userIdentityMappings) Update(userIdentityMapping *v1.UserIdentityMapping) (result *v1.UserIdentityMapping, err error) { + result = &v1.UserIdentityMapping{} + err = c.client.Put(). + Resource("useridentitymappings"). + Name(userIdentityMapping.Name). + Body(userIdentityMapping). + Do(). + Into(result) + return +} + +// Delete takes name of the userIdentityMapping and deletes it. Returns an error if one occurs. +func (c *userIdentityMappings) Delete(name string, options *meta_v1.DeleteOptions) error { + return c.client.Delete(). + Resource("useridentitymappings"). + Name(name). + Body(options). + Do(). + Error() +} diff --git a/user/informers/externalversions/factory.go b/user/informers/externalversions/factory.go new file mode 100644 index 0000000000..0665840174 --- /dev/null +++ b/user/informers/externalversions/factory.go @@ -0,0 +1,102 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + versioned "github.com/openshift/client-go/user/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/user/informers/externalversions/internalinterfaces" + user "github.com/openshift/client-go/user/informers/externalversions/user" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" + reflect "reflect" + sync "sync" + time "time" +) + +type sharedInformerFactory struct { + client versioned.Interface + lock sync.Mutex + defaultResync time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory +func NewSharedInformerFactory(client versioned.Interface, defaultResync time.Duration) SharedInformerFactory { + return &sharedInformerFactory{ + client: client, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + } +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + informer = newFunc(f.client, f.defaultResync) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + User() user.Interface +} + +func (f *sharedInformerFactory) User() user.Interface { + return user.New(f) +} diff --git a/user/informers/externalversions/generic.go b/user/informers/externalversions/generic.go new file mode 100644 index 0000000000..aa59903d43 --- /dev/null +++ b/user/informers/externalversions/generic.go @@ -0,0 +1,49 @@ +// This file was automatically generated by informer-gen + +package externalversions + +import ( + "fmt" + v1 "github.com/openshift/api/user/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=User, Version=V1 + case v1.SchemeGroupVersion.WithResource("groups"): + return &genericInformer{resource: resource.GroupResource(), informer: f.User().V1().Groups().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("identities"): + return &genericInformer{resource: resource.GroupResource(), informer: f.User().V1().Identities().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("users"): + return &genericInformer{resource: resource.GroupResource(), informer: f.User().V1().Users().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/user/informers/externalversions/internalinterfaces/factory_interfaces.go b/user/informers/externalversions/internalinterfaces/factory_interfaces.go new file mode 100644 index 0000000000..b7e2b1ab05 --- /dev/null +++ b/user/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -0,0 +1,18 @@ +// This file was automatically generated by informer-gen + +package internalinterfaces + +import ( + versioned "github.com/openshift/client-go/user/clientset/versioned" + runtime "k8s.io/apimachinery/pkg/runtime" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} diff --git a/user/informers/externalversions/user/interface.go b/user/informers/externalversions/user/interface.go new file mode 100644 index 0000000000..1c15c60863 --- /dev/null +++ b/user/informers/externalversions/user/interface.go @@ -0,0 +1,28 @@ +// This file was automatically generated by informer-gen + +package user + +import ( + internalinterfaces "github.com/openshift/client-go/user/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/user/informers/externalversions/user/v1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &group{f} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.SharedInformerFactory) +} diff --git a/user/informers/externalversions/user/v1/group.go b/user/informers/externalversions/user/v1/group.go new file mode 100644 index 0000000000..58cfb33944 --- /dev/null +++ b/user/informers/externalversions/user/v1/group.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + user_v1 "github.com/openshift/api/user/v1" + versioned "github.com/openshift/client-go/user/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/user/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/user/listers/user/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// GroupInformer provides access to a shared informer and lister for +// Groups. +type GroupInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.GroupLister +} + +type groupInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewGroupInformer constructs a new informer for Group type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewGroupInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.UserV1().Groups().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.UserV1().Groups().Watch(options) + }, + }, + &user_v1.Group{}, + resyncPeriod, + indexers, + ) +} + +func defaultGroupInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewGroupInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *groupInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&user_v1.Group{}, defaultGroupInformer) +} + +func (f *groupInformer) Lister() v1.GroupLister { + return v1.NewGroupLister(f.Informer().GetIndexer()) +} diff --git a/user/informers/externalversions/user/v1/identity.go b/user/informers/externalversions/user/v1/identity.go new file mode 100644 index 0000000000..52d89f55ff --- /dev/null +++ b/user/informers/externalversions/user/v1/identity.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + user_v1 "github.com/openshift/api/user/v1" + versioned "github.com/openshift/client-go/user/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/user/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/user/listers/user/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// IdentityInformer provides access to a shared informer and lister for +// Identities. +type IdentityInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.IdentityLister +} + +type identityInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewIdentityInformer constructs a new informer for Identity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIdentityInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.UserV1().Identities().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.UserV1().Identities().Watch(options) + }, + }, + &user_v1.Identity{}, + resyncPeriod, + indexers, + ) +} + +func defaultIdentityInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewIdentityInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *identityInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&user_v1.Identity{}, defaultIdentityInformer) +} + +func (f *identityInformer) Lister() v1.IdentityLister { + return v1.NewIdentityLister(f.Informer().GetIndexer()) +} diff --git a/user/informers/externalversions/user/v1/interface.go b/user/informers/externalversions/user/v1/interface.go new file mode 100644 index 0000000000..ebc61245ea --- /dev/null +++ b/user/informers/externalversions/user/v1/interface.go @@ -0,0 +1,41 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + internalinterfaces "github.com/openshift/client-go/user/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Groups returns a GroupInformer. + Groups() GroupInformer + // Identities returns a IdentityInformer. + Identities() IdentityInformer + // Users returns a UserInformer. + Users() UserInformer +} + +type version struct { + internalinterfaces.SharedInformerFactory +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory) Interface { + return &version{f} +} + +// Groups returns a GroupInformer. +func (v *version) Groups() GroupInformer { + return &groupInformer{factory: v.SharedInformerFactory} +} + +// Identities returns a IdentityInformer. +func (v *version) Identities() IdentityInformer { + return &identityInformer{factory: v.SharedInformerFactory} +} + +// Users returns a UserInformer. +func (v *version) Users() UserInformer { + return &userInformer{factory: v.SharedInformerFactory} +} diff --git a/user/informers/externalversions/user/v1/user.go b/user/informers/externalversions/user/v1/user.go new file mode 100644 index 0000000000..b39da09e99 --- /dev/null +++ b/user/informers/externalversions/user/v1/user.go @@ -0,0 +1,57 @@ +// This file was automatically generated by informer-gen + +package v1 + +import ( + user_v1 "github.com/openshift/api/user/v1" + versioned "github.com/openshift/client-go/user/clientset/versioned" + internalinterfaces "github.com/openshift/client-go/user/informers/externalversions/internalinterfaces" + v1 "github.com/openshift/client-go/user/listers/user/v1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + time "time" +) + +// UserInformer provides access to a shared informer and lister for +// Users. +type UserInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.UserLister +} + +type userInformer struct { + factory internalinterfaces.SharedInformerFactory +} + +// NewUserInformer constructs a new informer for User type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewUserInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { + return client.UserV1().Users().List(options) + }, + WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { + return client.UserV1().Users().Watch(options) + }, + }, + &user_v1.User{}, + resyncPeriod, + indexers, + ) +} + +func defaultUserInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewUserInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) +} + +func (f *userInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&user_v1.User{}, defaultUserInformer) +} + +func (f *userInformer) Lister() v1.UserLister { + return v1.NewUserLister(f.Informer().GetIndexer()) +} diff --git a/user/listers/user/v1/expansion_generated.go b/user/listers/user/v1/expansion_generated.go new file mode 100644 index 0000000000..b0b616efaf --- /dev/null +++ b/user/listers/user/v1/expansion_generated.go @@ -0,0 +1,15 @@ +// This file was automatically generated by lister-gen + +package v1 + +// GroupListerExpansion allows custom methods to be added to +// GroupLister. +type GroupListerExpansion interface{} + +// IdentityListerExpansion allows custom methods to be added to +// IdentityLister. +type IdentityListerExpansion interface{} + +// UserListerExpansion allows custom methods to be added to +// UserLister. +type UserListerExpansion interface{} diff --git a/user/listers/user/v1/group.go b/user/listers/user/v1/group.go new file mode 100644 index 0000000000..c8f81ea2a3 --- /dev/null +++ b/user/listers/user/v1/group.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/user/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// GroupLister helps list Groups. +type GroupLister interface { + // List lists all Groups in the indexer. + List(selector labels.Selector) (ret []*v1.Group, err error) + // Get retrieves the Group from the index for a given name. + Get(name string) (*v1.Group, error) + GroupListerExpansion +} + +// groupLister implements the GroupLister interface. +type groupLister struct { + indexer cache.Indexer +} + +// NewGroupLister returns a new GroupLister. +func NewGroupLister(indexer cache.Indexer) GroupLister { + return &groupLister{indexer: indexer} +} + +// List lists all Groups in the indexer. +func (s *groupLister) List(selector labels.Selector) (ret []*v1.Group, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Group)) + }) + return ret, err +} + +// Get retrieves the Group from the index for a given name. +func (s *groupLister) Get(name string) (*v1.Group, error) { + key := &v1.Group{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("group"), name) + } + return obj.(*v1.Group), nil +} diff --git a/user/listers/user/v1/identity.go b/user/listers/user/v1/identity.go new file mode 100644 index 0000000000..1479eb74f7 --- /dev/null +++ b/user/listers/user/v1/identity.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/user/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IdentityLister helps list Identities. +type IdentityLister interface { + // List lists all Identities in the indexer. + List(selector labels.Selector) (ret []*v1.Identity, err error) + // Get retrieves the Identity from the index for a given name. + Get(name string) (*v1.Identity, error) + IdentityListerExpansion +} + +// identityLister implements the IdentityLister interface. +type identityLister struct { + indexer cache.Indexer +} + +// NewIdentityLister returns a new IdentityLister. +func NewIdentityLister(indexer cache.Indexer) IdentityLister { + return &identityLister{indexer: indexer} +} + +// List lists all Identities in the indexer. +func (s *identityLister) List(selector labels.Selector) (ret []*v1.Identity, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Identity)) + }) + return ret, err +} + +// Get retrieves the Identity from the index for a given name. +func (s *identityLister) Get(name string) (*v1.Identity, error) { + key := &v1.Identity{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("identity"), name) + } + return obj.(*v1.Identity), nil +} diff --git a/user/listers/user/v1/user.go b/user/listers/user/v1/user.go new file mode 100644 index 0000000000..a097185a26 --- /dev/null +++ b/user/listers/user/v1/user.go @@ -0,0 +1,51 @@ +// This file was automatically generated by lister-gen + +package v1 + +import ( + v1 "github.com/openshift/api/user/v1" + "k8s.io/apimachinery/pkg/api/errors" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// UserLister helps list Users. +type UserLister interface { + // List lists all Users in the indexer. + List(selector labels.Selector) (ret []*v1.User, err error) + // Get retrieves the User from the index for a given name. + Get(name string) (*v1.User, error) + UserListerExpansion +} + +// userLister implements the UserLister interface. +type userLister struct { + indexer cache.Indexer +} + +// NewUserLister returns a new UserLister. +func NewUserLister(indexer cache.Indexer) UserLister { + return &userLister{indexer: indexer} +} + +// List lists all Users in the indexer. +func (s *userLister) List(selector labels.Selector) (ret []*v1.User, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.User)) + }) + return ret, err +} + +// Get retrieves the User from the index for a given name. +func (s *userLister) Get(name string) (*v1.User, error) { + key := &v1.User{ObjectMeta: meta_v1.ObjectMeta{Name: name}} + obj, exists, err := s.indexer.Get(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("user"), name) + } + return obj.(*v1.User), nil +}