From 194dce26cdff14b7f10f966e980ef1825200265a Mon Sep 17 00:00:00 2001 From: Murali Paluru Date: Wed, 14 Feb 2018 14:51:01 -0700 Subject: [PATCH] generated files --- .../v3/zz_generated_deepcopy.go | 120 +++++++++ .../v3/zz_generated_k8s_client.go | 16 ++ ...rated_project_network_policy_controller.go | 252 ++++++++++++++++++ ...roject_network_policy_lifecycle_adapter.go | 51 ++++ .../v3/zz_generated_scheme.go | 2 + client/management/v3/zz_generated_client.go | 2 + .../v3/zz_generated_project_network_policy.go | 105 ++++++++ ...z_generated_project_network_policy_spec.go | 12 + ...generated_project_network_policy_status.go | 8 + 9 files changed, 568 insertions(+) create mode 100644 apis/management.cattle.io/v3/zz_generated_project_network_policy_controller.go create mode 100644 apis/management.cattle.io/v3/zz_generated_project_network_policy_lifecycle_adapter.go create mode 100644 client/management/v3/zz_generated_project_network_policy.go create mode 100644 client/management/v3/zz_generated_project_network_policy_spec.go create mode 100644 client/management/v3/zz_generated_project_network_policy_status.go diff --git a/apis/management.cattle.io/v3/zz_generated_deepcopy.go b/apis/management.cattle.io/v3/zz_generated_deepcopy.go index 8fb321eb..971d9919 100644 --- a/apis/management.cattle.io/v3/zz_generated_deepcopy.go +++ b/apis/management.cattle.io/v3/zz_generated_deepcopy.go @@ -551,6 +551,22 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { in.(*ProjectLoggingSpec).DeepCopyInto(out.(*ProjectLoggingSpec)) return nil }, InType: reflect.TypeOf(&ProjectLoggingSpec{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ProjectNetworkPolicy).DeepCopyInto(out.(*ProjectNetworkPolicy)) + return nil + }, InType: reflect.TypeOf(&ProjectNetworkPolicy{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ProjectNetworkPolicyList).DeepCopyInto(out.(*ProjectNetworkPolicyList)) + return nil + }, InType: reflect.TypeOf(&ProjectNetworkPolicyList{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ProjectNetworkPolicySpec).DeepCopyInto(out.(*ProjectNetworkPolicySpec)) + return nil + }, InType: reflect.TypeOf(&ProjectNetworkPolicySpec{})}, + conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { + in.(*ProjectNetworkPolicyStatus).DeepCopyInto(out.(*ProjectNetworkPolicyStatus)) + return nil + }, InType: reflect.TypeOf(&ProjectNetworkPolicyStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error { in.(*ProjectRoleTemplateBinding).DeepCopyInto(out.(*ProjectRoleTemplateBinding)) return nil @@ -4419,6 +4435,110 @@ func (in *ProjectLoggingSpec) DeepCopy() *ProjectLoggingSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectNetworkPolicy) DeepCopyInto(out *ProjectNetworkPolicy) { + *out = *in + out.Namespaced = in.Namespaced + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + if in.Status != nil { + in, out := &in.Status, &out.Status + if *in == nil { + *out = nil + } else { + *out = new(ProjectNetworkPolicyStatus) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectNetworkPolicy. +func (in *ProjectNetworkPolicy) DeepCopy() *ProjectNetworkPolicy { + if in == nil { + return nil + } + out := new(ProjectNetworkPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectNetworkPolicy) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectNetworkPolicyList) DeepCopyInto(out *ProjectNetworkPolicyList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ProjectNetworkPolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectNetworkPolicyList. +func (in *ProjectNetworkPolicyList) DeepCopy() *ProjectNetworkPolicyList { + if in == nil { + return nil + } + out := new(ProjectNetworkPolicyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectNetworkPolicyList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } else { + return nil + } +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectNetworkPolicySpec) DeepCopyInto(out *ProjectNetworkPolicySpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectNetworkPolicySpec. +func (in *ProjectNetworkPolicySpec) DeepCopy() *ProjectNetworkPolicySpec { + if in == nil { + return nil + } + out := new(ProjectNetworkPolicySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectNetworkPolicyStatus) DeepCopyInto(out *ProjectNetworkPolicyStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectNetworkPolicyStatus. +func (in *ProjectNetworkPolicyStatus) DeepCopy() *ProjectNetworkPolicyStatus { + if in == nil { + return nil + } + out := new(ProjectNetworkPolicyStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ProjectRoleTemplateBinding) DeepCopyInto(out *ProjectRoleTemplateBinding) { *out = *in diff --git a/apis/management.cattle.io/v3/zz_generated_k8s_client.go b/apis/management.cattle.io/v3/zz_generated_k8s_client.go index 41490e2e..d785cf2a 100644 --- a/apis/management.cattle.io/v3/zz_generated_k8s_client.go +++ b/apis/management.cattle.io/v3/zz_generated_k8s_client.go @@ -38,6 +38,7 @@ type Interface interface { TokensGetter DynamicSchemasGetter PreferencesGetter + ProjectNetworkPoliciesGetter ClusterLoggingsGetter ProjectLoggingsGetter ListenConfigsGetter @@ -82,6 +83,7 @@ type Client struct { tokenControllers map[string]TokenController dynamicSchemaControllers map[string]DynamicSchemaController preferenceControllers map[string]PreferenceController + projectNetworkPolicyControllers map[string]ProjectNetworkPolicyController clusterLoggingControllers map[string]ClusterLoggingController projectLoggingControllers map[string]ProjectLoggingController listenConfigControllers map[string]ListenConfigController @@ -135,6 +137,7 @@ func NewForConfig(config rest.Config) (Interface, error) { tokenControllers: map[string]TokenController{}, dynamicSchemaControllers: map[string]DynamicSchemaController{}, preferenceControllers: map[string]PreferenceController{}, + projectNetworkPolicyControllers: map[string]ProjectNetworkPolicyController{}, clusterLoggingControllers: map[string]ClusterLoggingController{}, projectLoggingControllers: map[string]ProjectLoggingController{}, listenConfigControllers: map[string]ListenConfigController{}, @@ -475,6 +478,19 @@ func (c *Client) Preferences(namespace string) PreferenceInterface { } } +type ProjectNetworkPoliciesGetter interface { + ProjectNetworkPolicies(namespace string) ProjectNetworkPolicyInterface +} + +func (c *Client) ProjectNetworkPolicies(namespace string) ProjectNetworkPolicyInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ProjectNetworkPolicyResource, ProjectNetworkPolicyGroupVersionKind, projectNetworkPolicyFactory{}) + return &projectNetworkPolicyClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + type ClusterLoggingsGetter interface { ClusterLoggings(namespace string) ClusterLoggingInterface } diff --git a/apis/management.cattle.io/v3/zz_generated_project_network_policy_controller.go b/apis/management.cattle.io/v3/zz_generated_project_network_policy_controller.go new file mode 100644 index 00000000..eee3b3a4 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_project_network_policy_controller.go @@ -0,0 +1,252 @@ +package v3 + +import ( + "context" + + "github.com/rancher/norman/clientbase" + "github.com/rancher/norman/controller" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/tools/cache" +) + +var ( + ProjectNetworkPolicyGroupVersionKind = schema.GroupVersionKind{ + Version: Version, + Group: GroupName, + Kind: "ProjectNetworkPolicy", + } + ProjectNetworkPolicyResource = metav1.APIResource{ + Name: "projectnetworkpolicies", + SingularName: "projectnetworkpolicy", + Namespaced: true, + + Kind: ProjectNetworkPolicyGroupVersionKind.Kind, + } +) + +type ProjectNetworkPolicyList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ProjectNetworkPolicy +} + +type ProjectNetworkPolicyHandlerFunc func(key string, obj *ProjectNetworkPolicy) error + +type ProjectNetworkPolicyLister interface { + List(namespace string, selector labels.Selector) (ret []*ProjectNetworkPolicy, err error) + Get(namespace, name string) (*ProjectNetworkPolicy, error) +} + +type ProjectNetworkPolicyController interface { + Informer() cache.SharedIndexInformer + Lister() ProjectNetworkPolicyLister + AddHandler(name string, handler ProjectNetworkPolicyHandlerFunc) + AddClusterScopedHandler(name, clusterName string, handler ProjectNetworkPolicyHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type ProjectNetworkPolicyInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*ProjectNetworkPolicy) (*ProjectNetworkPolicy, error) + GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ProjectNetworkPolicy, error) + Get(name string, opts metav1.GetOptions) (*ProjectNetworkPolicy, error) + Update(*ProjectNetworkPolicy) (*ProjectNetworkPolicy, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*ProjectNetworkPolicyList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() ProjectNetworkPolicyController + AddHandler(name string, sync ProjectNetworkPolicyHandlerFunc) + AddLifecycle(name string, lifecycle ProjectNetworkPolicyLifecycle) + AddClusterScopedHandler(name, clusterName string, sync ProjectNetworkPolicyHandlerFunc) + AddClusterScopedLifecycle(name, clusterName string, lifecycle ProjectNetworkPolicyLifecycle) +} + +type projectNetworkPolicyLister struct { + controller *projectNetworkPolicyController +} + +func (l *projectNetworkPolicyLister) List(namespace string, selector labels.Selector) (ret []*ProjectNetworkPolicy, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*ProjectNetworkPolicy)) + }) + return +} + +func (l *projectNetworkPolicyLister) Get(namespace, name string) (*ProjectNetworkPolicy, error) { + var key string + if namespace != "" { + key = namespace + "/" + name + } else { + key = name + } + obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(schema.GroupResource{ + Group: ProjectNetworkPolicyGroupVersionKind.Group, + Resource: "projectNetworkPolicy", + }, name) + } + return obj.(*ProjectNetworkPolicy), nil +} + +type projectNetworkPolicyController struct { + controller.GenericController +} + +func (c *projectNetworkPolicyController) Lister() ProjectNetworkPolicyLister { + return &projectNetworkPolicyLister{ + controller: c, + } +} + +func (c *projectNetworkPolicyController) AddHandler(name string, handler ProjectNetworkPolicyHandlerFunc) { + c.GenericController.AddHandler(name, func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + return handler(key, obj.(*ProjectNetworkPolicy)) + }) +} + +func (c *projectNetworkPolicyController) AddClusterScopedHandler(name, cluster string, handler ProjectNetworkPolicyHandlerFunc) { + c.GenericController.AddHandler(name, func(key string) error { + obj, exists, err := c.Informer().GetStore().GetByKey(key) + if err != nil { + return err + } + if !exists { + return handler(key, nil) + } + + if !controller.ObjectInCluster(cluster, obj) { + return nil + } + + return handler(key, obj.(*ProjectNetworkPolicy)) + }) +} + +type projectNetworkPolicyFactory struct { +} + +func (c projectNetworkPolicyFactory) Object() runtime.Object { + return &ProjectNetworkPolicy{} +} + +func (c projectNetworkPolicyFactory) List() runtime.Object { + return &ProjectNetworkPolicyList{} +} + +func (s *projectNetworkPolicyClient) Controller() ProjectNetworkPolicyController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.projectNetworkPolicyControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(ProjectNetworkPolicyGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &projectNetworkPolicyController{ + GenericController: genericController, + } + + s.client.projectNetworkPolicyControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type projectNetworkPolicyClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller ProjectNetworkPolicyController +} + +func (s *projectNetworkPolicyClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *projectNetworkPolicyClient) Create(o *ProjectNetworkPolicy) (*ProjectNetworkPolicy, error) { + obj, err := s.objectClient.Create(o) + return obj.(*ProjectNetworkPolicy), err +} + +func (s *projectNetworkPolicyClient) Get(name string, opts metav1.GetOptions) (*ProjectNetworkPolicy, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*ProjectNetworkPolicy), err +} + +func (s *projectNetworkPolicyClient) GetNamespaced(namespace, name string, opts metav1.GetOptions) (*ProjectNetworkPolicy, error) { + obj, err := s.objectClient.GetNamespaced(namespace, name, opts) + return obj.(*ProjectNetworkPolicy), err +} + +func (s *projectNetworkPolicyClient) Update(o *ProjectNetworkPolicy) (*ProjectNetworkPolicy, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*ProjectNetworkPolicy), err +} + +func (s *projectNetworkPolicyClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *projectNetworkPolicyClient) DeleteNamespaced(namespace, name string, options *metav1.DeleteOptions) error { + return s.objectClient.DeleteNamespaced(namespace, name, options) +} + +func (s *projectNetworkPolicyClient) List(opts metav1.ListOptions) (*ProjectNetworkPolicyList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*ProjectNetworkPolicyList), err +} + +func (s *projectNetworkPolicyClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +// Patch applies the patch and returns the patched deployment. +func (s *projectNetworkPolicyClient) Patch(o *ProjectNetworkPolicy, data []byte, subresources ...string) (*ProjectNetworkPolicy, error) { + obj, err := s.objectClient.Patch(o.Name, o, data, subresources...) + return obj.(*ProjectNetworkPolicy), err +} + +func (s *projectNetworkPolicyClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} + +func (s *projectNetworkPolicyClient) AddHandler(name string, sync ProjectNetworkPolicyHandlerFunc) { + s.Controller().AddHandler(name, sync) +} + +func (s *projectNetworkPolicyClient) AddLifecycle(name string, lifecycle ProjectNetworkPolicyLifecycle) { + sync := NewProjectNetworkPolicyLifecycleAdapter(name, false, s, lifecycle) + s.AddHandler(name, sync) +} + +func (s *projectNetworkPolicyClient) AddClusterScopedHandler(name, clusterName string, sync ProjectNetworkPolicyHandlerFunc) { + s.Controller().AddClusterScopedHandler(name, clusterName, sync) +} + +func (s *projectNetworkPolicyClient) AddClusterScopedLifecycle(name, clusterName string, lifecycle ProjectNetworkPolicyLifecycle) { + sync := NewProjectNetworkPolicyLifecycleAdapter(name+"_"+clusterName, true, s, lifecycle) + s.AddClusterScopedHandler(name, clusterName, sync) +} diff --git a/apis/management.cattle.io/v3/zz_generated_project_network_policy_lifecycle_adapter.go b/apis/management.cattle.io/v3/zz_generated_project_network_policy_lifecycle_adapter.go new file mode 100644 index 00000000..0ac47e84 --- /dev/null +++ b/apis/management.cattle.io/v3/zz_generated_project_network_policy_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type ProjectNetworkPolicyLifecycle interface { + Create(obj *ProjectNetworkPolicy) (*ProjectNetworkPolicy, error) + Remove(obj *ProjectNetworkPolicy) (*ProjectNetworkPolicy, error) + Updated(obj *ProjectNetworkPolicy) (*ProjectNetworkPolicy, error) +} + +type projectNetworkPolicyLifecycleAdapter struct { + lifecycle ProjectNetworkPolicyLifecycle +} + +func (w *projectNetworkPolicyLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ProjectNetworkPolicy)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *projectNetworkPolicyLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ProjectNetworkPolicy)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *projectNetworkPolicyLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ProjectNetworkPolicy)) + if o == nil { + return nil, err + } + return o, err +} + +func NewProjectNetworkPolicyLifecycleAdapter(name string, clusterScoped bool, client ProjectNetworkPolicyInterface, l ProjectNetworkPolicyLifecycle) ProjectNetworkPolicyHandlerFunc { + adapter := &projectNetworkPolicyLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, clusterScoped, adapter, client.ObjectClient()) + return func(key string, obj *ProjectNetworkPolicy) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/apis/management.cattle.io/v3/zz_generated_scheme.go b/apis/management.cattle.io/v3/zz_generated_scheme.go index b115a352..47a14063 100644 --- a/apis/management.cattle.io/v3/zz_generated_scheme.go +++ b/apis/management.cattle.io/v3/zz_generated_scheme.go @@ -81,6 +81,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &DynamicSchemaList{}, &Preference{}, &PreferenceList{}, + &ProjectNetworkPolicy{}, + &ProjectNetworkPolicyList{}, &ClusterLogging{}, &ClusterLoggingList{}, &ProjectLogging{}, diff --git a/client/management/v3/zz_generated_client.go b/client/management/v3/zz_generated_client.go index 480490e3..c4f96497 100644 --- a/client/management/v3/zz_generated_client.go +++ b/client/management/v3/zz_generated_client.go @@ -31,6 +31,7 @@ type Client struct { Token TokenOperations DynamicSchema DynamicSchemaOperations Preference PreferenceOperations + ProjectNetworkPolicy ProjectNetworkPolicyOperations ClusterLogging ClusterLoggingOperations ProjectLogging ProjectLoggingOperations ListenConfig ListenConfigOperations @@ -80,6 +81,7 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) { client.Token = newTokenClient(client) client.DynamicSchema = newDynamicSchemaClient(client) client.Preference = newPreferenceClient(client) + client.ProjectNetworkPolicy = newProjectNetworkPolicyClient(client) client.ClusterLogging = newClusterLoggingClient(client) client.ProjectLogging = newProjectLoggingClient(client) client.ListenConfig = newListenConfigClient(client) diff --git a/client/management/v3/zz_generated_project_network_policy.go b/client/management/v3/zz_generated_project_network_policy.go new file mode 100644 index 00000000..bcdcb27a --- /dev/null +++ b/client/management/v3/zz_generated_project_network_policy.go @@ -0,0 +1,105 @@ +package client + +import ( + "github.com/rancher/norman/types" +) + +const ( + ProjectNetworkPolicyType = "projectNetworkPolicy" + ProjectNetworkPolicyFieldAnnotations = "annotations" + ProjectNetworkPolicyFieldCreated = "created" + ProjectNetworkPolicyFieldCreatorID = "creatorId" + ProjectNetworkPolicyFieldDescription = "description" + ProjectNetworkPolicyFieldLabels = "labels" + ProjectNetworkPolicyFieldName = "name" + ProjectNetworkPolicyFieldNamespaceId = "namespaceId" + ProjectNetworkPolicyFieldOwnerReferences = "ownerReferences" + ProjectNetworkPolicyFieldProjectId = "projectId" + ProjectNetworkPolicyFieldRemoved = "removed" + ProjectNetworkPolicyFieldState = "state" + ProjectNetworkPolicyFieldStatus = "status" + ProjectNetworkPolicyFieldTransitioning = "transitioning" + ProjectNetworkPolicyFieldTransitioningMessage = "transitioningMessage" + ProjectNetworkPolicyFieldUuid = "uuid" +) + +type ProjectNetworkPolicy struct { + types.Resource + Annotations map[string]string `json:"annotations,omitempty"` + Created string `json:"created,omitempty"` + CreatorID string `json:"creatorId,omitempty"` + Description string `json:"description,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + Name string `json:"name,omitempty"` + NamespaceId string `json:"namespaceId,omitempty"` + OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"` + ProjectId string `json:"projectId,omitempty"` + Removed string `json:"removed,omitempty"` + State string `json:"state,omitempty"` + Status *ProjectNetworkPolicyStatus `json:"status,omitempty"` + Transitioning string `json:"transitioning,omitempty"` + TransitioningMessage string `json:"transitioningMessage,omitempty"` + Uuid string `json:"uuid,omitempty"` +} +type ProjectNetworkPolicyCollection struct { + types.Collection + Data []ProjectNetworkPolicy `json:"data,omitempty"` + client *ProjectNetworkPolicyClient +} + +type ProjectNetworkPolicyClient struct { + apiClient *Client +} + +type ProjectNetworkPolicyOperations interface { + List(opts *types.ListOpts) (*ProjectNetworkPolicyCollection, error) + Create(opts *ProjectNetworkPolicy) (*ProjectNetworkPolicy, error) + Update(existing *ProjectNetworkPolicy, updates interface{}) (*ProjectNetworkPolicy, error) + ByID(id string) (*ProjectNetworkPolicy, error) + Delete(container *ProjectNetworkPolicy) error +} + +func newProjectNetworkPolicyClient(apiClient *Client) *ProjectNetworkPolicyClient { + return &ProjectNetworkPolicyClient{ + apiClient: apiClient, + } +} + +func (c *ProjectNetworkPolicyClient) Create(container *ProjectNetworkPolicy) (*ProjectNetworkPolicy, error) { + resp := &ProjectNetworkPolicy{} + err := c.apiClient.Ops.DoCreate(ProjectNetworkPolicyType, container, resp) + return resp, err +} + +func (c *ProjectNetworkPolicyClient) Update(existing *ProjectNetworkPolicy, updates interface{}) (*ProjectNetworkPolicy, error) { + resp := &ProjectNetworkPolicy{} + err := c.apiClient.Ops.DoUpdate(ProjectNetworkPolicyType, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ProjectNetworkPolicyClient) List(opts *types.ListOpts) (*ProjectNetworkPolicyCollection, error) { + resp := &ProjectNetworkPolicyCollection{} + err := c.apiClient.Ops.DoList(ProjectNetworkPolicyType, opts, resp) + resp.client = c + return resp, err +} + +func (cc *ProjectNetworkPolicyCollection) Next() (*ProjectNetworkPolicyCollection, error) { + if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" { + resp := &ProjectNetworkPolicyCollection{} + err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp) + resp.client = cc.client + return resp, err + } + return nil, nil +} + +func (c *ProjectNetworkPolicyClient) ByID(id string) (*ProjectNetworkPolicy, error) { + resp := &ProjectNetworkPolicy{} + err := c.apiClient.Ops.DoByID(ProjectNetworkPolicyType, id, resp) + return resp, err +} + +func (c *ProjectNetworkPolicyClient) Delete(container *ProjectNetworkPolicy) error { + return c.apiClient.Ops.DoResourceDelete(ProjectNetworkPolicyType, &container.Resource) +} diff --git a/client/management/v3/zz_generated_project_network_policy_spec.go b/client/management/v3/zz_generated_project_network_policy_spec.go new file mode 100644 index 00000000..f153be8a --- /dev/null +++ b/client/management/v3/zz_generated_project_network_policy_spec.go @@ -0,0 +1,12 @@ +package client + +const ( + ProjectNetworkPolicySpecType = "projectNetworkPolicySpec" + ProjectNetworkPolicySpecFieldDescription = "description" + ProjectNetworkPolicySpecFieldProjectId = "projectId" +) + +type ProjectNetworkPolicySpec struct { + Description string `json:"description,omitempty"` + ProjectId string `json:"projectId,omitempty"` +} diff --git a/client/management/v3/zz_generated_project_network_policy_status.go b/client/management/v3/zz_generated_project_network_policy_status.go new file mode 100644 index 00000000..cef3c163 --- /dev/null +++ b/client/management/v3/zz_generated_project_network_policy_status.go @@ -0,0 +1,8 @@ +package client + +const ( + ProjectNetworkPolicyStatusType = "projectNetworkPolicyStatus" +) + +type ProjectNetworkPolicyStatus struct { +}