diff --git a/vendor.conf b/vendor.conf index 5bc6cb49..9d525045 100644 --- a/vendor.conf +++ b/vendor.conf @@ -20,5 +20,5 @@ k8s.io/client-go v5.0.0 transitive=true github.com/gorilla/websocket v1.2.0 golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5 -github.com/rancher/norman 18d3f69aa84ed39326e731ebfa509cf104bf9ad1 -github.com/rancher/types e7e7b69880af3dad9b067e593c54ab350f2a0e33 +github.com/rancher/norman 8c0d4bfe2e63a801e4e21906d6b37a5173dadcbb +github.com/rancher/types a2625e8dc81780f5e4cfc05f771fe4bb1516fd44 diff --git a/vendor/github.com/rancher/norman/lifecycle/object.go b/vendor/github.com/rancher/norman/lifecycle/object.go index ca973017..6302d9ca 100644 --- a/vendor/github.com/rancher/norman/lifecycle/object.go +++ b/vendor/github.com/rancher/norman/lifecycle/object.go @@ -9,13 +9,13 @@ import ( ) var ( - initialized = "io.cattle.lifecycle.initialized" + created = "io.cattle.lifecycle.create" ) type ObjectLifecycle interface { - Initialize(obj runtime.Object) error - Finalize(obj runtime.Object) error - Updated(obj runtime.Object) error + Create(obj runtime.Object) (runtime.Object, error) + Finalize(obj runtime.Object) (runtime.Object, error) + Updated(obj runtime.Object) (runtime.Object, error) } type objectLifecycleAdapter struct { @@ -47,11 +47,18 @@ func (o *objectLifecycleAdapter) sync(key string, obj runtime.Object) error { return err } - if cont, err := o.initialize(metadata, obj); err != nil || !cont { + if cont, err := o.create(metadata, obj); err != nil || !cont { return err } - return o.lifecycle.Updated(obj.DeepCopyObject()) + if newObj, err := o.lifecycle.Updated(obj); err != nil { + return err + } else if newObj != nil { + _, err = o.objectClient.Update(metadata.GetName(), newObj) + return err + } + + return nil } func (o *objectLifecycleAdapter) finalize(metadata metav1.Object, obj runtime.Object) (bool, error) { @@ -79,20 +86,23 @@ func (o *objectLifecycleAdapter) finalize(metadata metav1.Object, obj runtime.Ob } metadata.SetFinalizers(finalizers) - if err := o.lifecycle.Finalize(obj); err != nil { + if newObj, err := o.lifecycle.Finalize(obj); err != nil { return false, err + } else if newObj != nil { + _, err = o.objectClient.Update(metadata.GetName(), newObj) + } else { + _, err = o.objectClient.Update(metadata.GetName(), obj) } - _, err = o.objectClient.Update(metadata.GetName(), obj) return false, err } -func (o *objectLifecycleAdapter) initializeKey() string { - return initialized + "." + o.name +func (o *objectLifecycleAdapter) createKey() string { + return created + "." + o.name } -func (o *objectLifecycleAdapter) initialize(metadata metav1.Object, obj runtime.Object) (bool, error) { - initialized := o.initializeKey() +func (o *objectLifecycleAdapter) create(metadata metav1.Object, obj runtime.Object) (bool, error) { + initialized := o.createKey() if metadata.GetLabels()[initialized] == "true" { return true, nil @@ -110,7 +120,10 @@ func (o *objectLifecycleAdapter) initialize(metadata metav1.Object, obj runtime. metadata.SetFinalizers(append(metadata.GetFinalizers(), o.name)) metadata.GetLabels()[initialized] = "true" - if err := o.lifecycle.Initialize(obj); err != nil { + if newObj, err := o.lifecycle.Create(obj); err != nil { + return false, err + } else if newObj != nil { + _, err = o.objectClient.Update(metadata.GetName(), newObj) return false, err } diff --git a/vendor/github.com/rancher/norman/types/definition/definition.go b/vendor/github.com/rancher/norman/types/definition/definition.go index 1e32b12f..40912afb 100644 --- a/vendor/github.com/rancher/norman/types/definition/definition.go +++ b/vendor/github.com/rancher/norman/types/definition/definition.go @@ -32,7 +32,11 @@ func SubType(fieldType string) string { } func GetType(data map[string]interface{}) string { - parts := strings.Split(GetFullType(data), "/") + return GetShortTypeFromFull(GetFullType(data)) +} + +func GetShortTypeFromFull(fullType string) string { + parts := strings.Split(fullType, "/") return parts[len(parts)-1] } diff --git a/vendor/github.com/rancher/norman/types/reflection.go b/vendor/github.com/rancher/norman/types/reflection.go index 37ceadff..060f9803 100644 --- a/vendor/github.com/rancher/norman/types/reflection.go +++ b/vendor/github.com/rancher/norman/types/reflection.go @@ -176,9 +176,9 @@ func (s *Schemas) importType(version *APIVersion, t reflect.Type, overrides ...r s.setupFilters(schema) schema.Mapper = mapper - s.AddSchema(schema) + s.AddSchema(*schema) - return schema, s.Err() + return s.Schema(&schema.Version, schema.ID), s.Err() } func jsonName(f reflect.StructField) string { diff --git a/vendor/github.com/rancher/norman/types/schemas.go b/vendor/github.com/rancher/norman/types/schemas.go index 43613cac..9457b50b 100644 --- a/vendor/github.com/rancher/norman/types/schemas.go +++ b/vendor/github.com/rancher/norman/types/schemas.go @@ -7,6 +7,7 @@ import ( "github.com/rancher/norman/name" "github.com/rancher/norman/types/convert" + "github.com/rancher/norman/types/definition" ) type SchemaCollection struct { @@ -17,10 +18,16 @@ type SchemaInitFunc func(*Schemas) *Schemas type MappersFactory func() []Mapper +type BackReference struct { + FieldName string + Schema *Schema +} + type Schemas struct { schemasByPath map[string]map[string]*Schema schemasBySubContext map[string]*Schema mappers map[string]map[string][]Mapper + references map[string][]BackReference DefaultMappers MappersFactory DefaultPostMappers MappersFactory versions []APIVersion @@ -33,6 +40,7 @@ func NewSchemas() *Schemas { schemasByPath: map[string]map[string]*Schema{}, schemasBySubContext: map[string]*Schema{}, mappers: map[string]map[string][]Mapper{}, + references: map[string][]BackReference{}, } } @@ -54,12 +62,12 @@ func (s *Schemas) SubContextSchemas() map[string]*Schema { func (s *Schemas) AddSchemas(schema *Schemas) *Schemas { for _, schema := range schema.Schemas() { - s.AddSchema(schema) + s.AddSchema(*schema) } return s } -func (s *Schemas) AddSchema(schema *Schema) *Schemas { +func (s *Schemas) AddSchema(schema Schema) *Schemas { schema.Type = "/meta/schemas/schema" if schema.ID == "" { s.errors = append(s.errors, fmt.Errorf("ID is not set on schema: %v", schema)) @@ -90,17 +98,38 @@ func (s *Schemas) AddSchema(schema *Schema) *Schemas { } if _, ok := schemas[schema.ID]; !ok { - schemas[schema.ID] = schema - s.schemas = append(s.schemas, schema) + schemas[schema.ID] = &schema + s.schemas = append(s.schemas, &schema) + + for name, field := range schema.ResourceFields { + if !definition.IsReferenceType(field.Type) { + continue + } + + refType := definition.SubType(field.Type) + if !strings.HasPrefix(refType, "/") { + refType = convert.ToFullReference(schema.Version.Path, refType) + } + + s.references[refType] = append(s.references[refType], BackReference{ + FieldName: name, + Schema: &schema, + }) + } } if schema.SubContext != "" { - s.schemasBySubContext[schema.SubContext] = schema + s.schemasBySubContext[schema.SubContext] = &schema } return s } +func (s *Schemas) References(schema *Schema) []BackReference { + refType := convert.ToFullReference(schema.Version.Path, schema.ID) + return s.references[refType] +} + func (s *Schemas) AddMapper(version *APIVersion, schemaID string, mapper Mapper) *Schemas { mappers, ok := s.mappers[version.Path] if !ok { diff --git a/vendor/github.com/rancher/norman/types/server_types.go b/vendor/github.com/rancher/norman/types/server_types.go index 4d4c3870..d8c2aa9b 100644 --- a/vendor/github.com/rancher/norman/types/server_types.go +++ b/vendor/github.com/rancher/norman/types/server_types.go @@ -147,6 +147,7 @@ type URLBuilder interface { ReverseSort(order SortOrder) string Sort(field string) string SetSubContext(subContext string) + FilterLink(schema *Schema, fieldName string, value string) string } type Store interface { diff --git a/vendor/github.com/rancher/types/.gitignore b/vendor/github.com/rancher/types/.gitignore index ed44c681..4dad1f76 100644 --- a/vendor/github.com/rancher/types/.gitignore +++ b/vendor/github.com/rancher/types/.gitignore @@ -4,3 +4,4 @@ *.swp /.trash-cache /.idea +types diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/auth_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/auth_types.go deleted file mode 100644 index d5f17aee..00000000 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/auth_types.go +++ /dev/null @@ -1,66 +0,0 @@ -package v3 - -import ( - extv1 "k8s.io/api/extensions/v1beta1" - rbacv1 "k8s.io/api/rbac/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type Project struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec ProjectSpec `json:"spec,omitempty"` -} - -type ProjectSpec struct { - DisplayName string `json:"displayName,omitempty" norman:"required"` - ClusterName string `json:"clusterName,omitempty" norman:"required,type=reference[cluster]"` -} - -type ProjectRoleTemplate struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Rules []rbacv1.PolicyRule `json:"rules,omitempty"` - Builtin bool `json:"builtin"` - - ProjectRoleTemplateNames []string `json:"projectRoleTemplateNames,omitempty" norman:"type=array[reference[projectRoleTemplate]]"` -} - -type PodSecurityPolicyTemplate struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec extv1.PodSecurityPolicySpec `json:"spec,omitempty"` -} - -type ProjectRoleTemplateBinding struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Subject rbacv1.Subject `json:"subject,omitempty"` - - ProjectName string `json:"projectName,omitempty" norman:"type=reference[project]"` - ProjectRoleTemplateName string `json:"projectRoleTemplateName,omitempty" norman:"type=reference[projectRoleTemplate]"` -} - -type ClusterRoleTemplate struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Rules []rbacv1.PolicyRule `json:"rules,omitempty"` - Builtin bool `json:"builtin"` - - ClusterRoleTemplateNames []string `json:"clusterRoleTemplateNames,omitempty" norman:"type=array[reference[clusterRoleTemplate]]"` -} - -type ClusterRoleTemplateBinding struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Subject rbacv1.Subject `json:"subject,omitempty"` - - ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster]"` - ClusterRoleTemplateName string `json:"clusterRoleTemplateName,omitempty" norman:"type=reference[clusterRoleTemplate]"` -} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/authn_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/authn_types.go new file mode 100644 index 00000000..3a84ea0f --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/authn_types.go @@ -0,0 +1,79 @@ +package v3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type Token struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + TokenID string `json:"tokenId,omitempty"` + UserIdentity Identity `json:"userIdentity,omitempty"` + GroupIdentities []Identity `json:"groupIdentities,omitempty"` + ProviderInfo map[string]string `json:"providerInfo,omitempty"` + User string `json:"user,omitempty"` + ExternalID string `json:"externalId,omitempty"` + AuthProvider string `json:"authProvider,omitempty"` + TTLMillis string `json:"ttl,omitempty"` + IdentityRefreshTTLMillis string `json:"identityRefreshTTL,omitempty"` + LastUpdateTime string `json:"lastUpdateTime,omitempty"` + IsDerived bool `json:"isDerived,omitempty"` + Description string `json:"description,omitempty"` +} + +type User struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Secret string `json:"secret,omitempty"` + ExternalID string `json:"externalId,omitempty"` +} + +type Group struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` +} + +type GroupMember struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + GroupName string `json:"groupName,omitempty" norman:"type=reference[group]"` + ExternalID string `json:"externalId,omitempty"` +} + +type Identity struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + DisplayName string `json:"displayName,omitempty"` + LoginName string `json:"loginName,omitempty"` + ProfilePicture string `json:"profilePicture,omitempty"` + ProfileURL string `json:"profileURL,omitempty"` + Kind string `json:"kind,omitempty"` + Me bool `json:"me,omitempty"` + MemberOf bool `json:"memberOf,omitempty"` + ExtraInfo map[string]string `json:"extraInfo,omitempty"` +} + +//LoginInput structure defines all properties that can be sent by client to create a token +type LoginInput struct { + TTLMillis string `json:"ttl,omitempty"` + IdentityRefreshTTLMillis string `json:"identityRefreshTTL,omitempty"` + Description string `json:"description,omitempty"` + ResponseType string `json:"responseType,omitempty"` //json or cookie + LocalCredential LocalCredential `json:"localCredential, omitempty"` + GithubCredential GithubCredential `json:"githubCredential, omitempty"` +} + +//LocalCredential stores the local auth creds +type LocalCredential struct { + Username string `json:"username"` + Password string `json:"password"` +} + +//GithubCredential stores the github auth creds +type GithubCredential struct { + Code string `json:"code"` +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/authz_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/authz_types.go new file mode 100644 index 00000000..afbc81bf --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/authz_types.go @@ -0,0 +1,57 @@ +package v3 + +import ( + extv1 "k8s.io/api/extensions/v1beta1" + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type Project struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ProjectSpec `json:"spec,omitempty"` +} + +type ProjectSpec struct { + DisplayName string `json:"displayName,omitempty" norman:"required"` + ClusterName string `json:"clusterName,omitempty" norman:"required,type=reference[cluster]"` + PodSecurityPolicyTemplateName string `json:"podSecurityPolicyTemplateName,omitempty" norman:"type=reference[podSecurityPolicyTemplate]"` +} + +type RoleTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Rules []rbacv1.PolicyRule `json:"rules,omitempty"` + Builtin bool `json:"builtin"` + + RoleTemplateNames []string `json:"roleTemplateNames,omitempty" norman:"type=array[reference[roleTemplate]]"` +} + +type PodSecurityPolicyTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec extv1.PodSecurityPolicySpec `json:"spec,omitempty"` +} + +type ProjectRoleTemplateBinding struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Subject rbacv1.Subject `json:"subject,omitempty"` + + ProjectName string `json:"projectName,omitempty" norman:"type=reference[project]"` + RoleTemplateName string `json:"roleTemplateName,omitempty" norman:"type=reference[roleTemplate]"` +} + +type ClusterRoleTemplateBinding struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Subject rbacv1.Subject `json:"subject,omitempty"` + + ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster]"` + RoleTemplateName string `json:"roleTemplateName,omitempty" norman:"type=reference[roleTemplate]"` +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/catalog_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/catalog_types.go new file mode 100644 index 00000000..9d16d369 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/catalog_types.go @@ -0,0 +1,114 @@ +package v3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type Catalog struct { + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of the desired behavior of the the cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Spec CatalogSpec `json:"spec"` + Status CatalogStatus `json:"status"` +} + +type CatalogSpec struct { + URL string `json:"url,omitempty"` + Branch string `json:"branch,omitempty"` + CatalogKind string `json:"catalogKind,omitempty"` +} + +type CatalogStatus struct { + Commit string `json:"commit,omitempty"` +} + +type Template struct { + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of the desired behavior of the the cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Spec TemplateSpec `json:"spec"` + Status TemplateStatus `json:"status"` +} + +type TemplateSpec struct { + CatalogName string `json:"catalogName,omitempty"` + + IsSystem string `json:"isSystem,omitempty"` + Description string `json:"description,omitempty"` + DefaultVersion string `json:"defaultVersion,omitempty" yaml:"default_version,omitempty"` + Path string `json:"path,omitempty"` + Maintainer string `json:"maintainer,omitempty"` + License string `json:"license,omitempty"` + ProjectURL string `json:"projectURL,omitempty" yaml:"project_url,omitempty"` + UpgradeFrom string `json:"upgradeFrom,omitempty"` + FolderName string `json:"folderName,omitempty"` + Catalog string `json:"catalogId,omitempty"` + Base string `json:"templateBase,omitempty"` + Icon string `json:"icon,omitempty"` + IconFilename string `json:"iconFilename,omitempty"` + Readme string `json:"readme,omitempty"` + + Categories []string `json:"categories,omitempty"` + Versions []TemplateVersionSpec `json:"versions,omitempty"` + + Category string `json:"category,omitempty"` +} + +type TemplateStatus struct { + // todo: +} + +type TemplateVersion struct { + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of the desired behavior of the the cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Spec TemplateVersionSpec `json:"spec"` + Status TemplateVersionStatus `json:"status"` +} + +type TemplateVersionSpec struct { + Revision *int `json:"revision,omitempty"` + Version string `json:"version,omitempty"` + MinimumRancherVersion string `json:"minimumRancherVersion,omitempty" yaml:"minimum_rancher_version,omitempty"` + MaximumRancherVersion string `json:"maximumRancherVersion,omitempty" yaml:"maximum_rancher_version,omitempty"` + UpgradeFrom string `json:"upgradeFrom,omitempty" yaml:"upgrade_from,omitempty"` + Readme string `json:"readme,omitempty"` + + Files []File `json:"files,omitempty"` + Questions []Question `json:"questions,omitempty"` +} + +type TemplateVersionStatus struct { + // todo +} + +type File struct { + Name string `json:"name,omitempty"` + Contents string `json:"contents,omitempty"` +} + +type Question struct { + Variable string `json:"variable,omitempty" yaml:"variable,omitempty"` + Label string `json:"label,omitempty" yaml:"label,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` + Required bool `json:"required,omitempty" yaml:"required,omitempty"` + Default string `json:"default,omitempty" yaml:"default,omitempty"` + Group string `json:"group,omitempty" yaml:"group,omitempty"` + MinLength int `json:"minLength,omitempty" yaml:"min_length,omitempty"` + MaxLength int `json:"maxLength,omitempty" yaml:"max_length,omitempty"` + Min int `json:"min,omitempty" yaml:"min,omitempty"` + Max int `json:"max,omitempty" yaml:"max,omitempty"` + Options []string `json:"options,omitempty" yaml:"options,omitempty"` + ValidChars string `json:"validChars,omitempty" yaml:"valid_chars,omitempty"` + InvalidChars string `json:"invalidChars,omitempty" yaml:"invalid_chars,omitempty"` +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/cluster_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/cluster_types.go index 6806c431..d87dda36 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/cluster_types.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/cluster_types.go @@ -35,11 +35,12 @@ type Cluster struct { } type ClusterSpec struct { - DisplayName string `json:"displayName"` - Description string `json:"description"` - GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"` - AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty"` - RancherKubernetesEngineConfig *RancherKubernetesEngineConfig `json:"rancherKubernetesEngineConfig,omitempty"` + Description string `json:"description"` + Internal bool `json:"internal" norman:"nocreate,noupdate"` + GoogleKubernetesEngineConfig *GoogleKubernetesEngineConfig `json:"googleKubernetesEngineConfig,omitempty"` + AzureKubernetesServiceConfig *AzureKubernetesServiceConfig `json:"azureKubernetesServiceConfig,omitempty"` + RancherKubernetesEngineConfig *RancherKubernetesEngineConfig `json:"rancherKubernetesEngineConfig,omitempty"` + DefaultPodSecurityPolicyTemplateName string `json:"defaultPodSecurityPolicyTemplateName,omitempty" norman:"type=reference[podSecurityPolicyTemplate]"` } type ClusterStatus struct { @@ -103,8 +104,53 @@ type GoogleKubernetesEngineConfig struct { Credential string `json:"credential,omitempty"` // Enable alpha feature EnableAlphaFeature bool `json:"enableAlphaFeature,omitempty"` + // Configuration for the HTTP (L7) load balancing controller addon + HTTPLoadBalancing bool `json:"httpLoadBalancing,omitempty"` + // Configuration for the horizontal pod autoscaling feature, which increases or decreases the number of replica pods a replication controller has based on the resource usage of the existing pods + HorizontalPodAutoscaling bool `json:"horizontalPodAutoscaling,omitempty"` + // Configuration for the Kubernetes Dashboard + KubernetesDashboard bool `json:"kubernetesDashboard,omitempty"` + // Configuration for NetworkPolicy + NetworkPolicyConfig bool `json:"networkPolicyConfig,omitempty"` + // The list of Google Compute Engine locations in which the cluster's nodes should be located + Locations []string `json:"locations,omitempty"` + // Image Type + ImageType string `json:"imageType,omitempty"` + // Network + Network string `json:"network,omitempty"` + // Sub Network + SubNetwork string `json:"subNetwork,omitempty"` + // Configuration for LegacyAbac + LegacyAbac bool `json:"legacyAbac,omitempty"` } type AzureKubernetesServiceConfig struct { //TBD } + +type ClusterEvent struct { + v1.Event + ClusterName string `json:"clusterName" norman:"type=reference[cluster]"` +} + +type ClusterRegistrationToken struct { + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of the desired behavior of the the cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Spec ClusterRegistrationTokenSpec `json:"spec"` + // Most recent observed status of the cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Status ClusterRegistrationTokenStatus `json:"status"` +} + +type ClusterRegistrationTokenSpec struct { +} + +type ClusterRegistrationTokenStatus struct { + Command string `json:"command"` + ManifestURL string `json:"manifestUrl"` + Token string `json:"token"` +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/machine_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/machine_types.go index c68d22da..12fae567 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/machine_types.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/machine_types.go @@ -59,11 +59,17 @@ type Machine struct { } type MachineStatus struct { - Conditions []MachineCondition `json:"conditions"` - NodeStatus v1.NodeStatus `json:"nodeStatus"` - NodeName string `json:"nodeName"` - Requested v1.ResourceList `json:"requested,omitempty"` - Limits v1.ResourceList `json:"limits,omitempty"` + Conditions []MachineCondition `json:"conditions"` + NodeStatus v1.NodeStatus `json:"nodeStatus"` + NodeName string `json:"nodeName"` + Requested v1.ResourceList `json:"requested,omitempty"` + Limits v1.ResourceList `json:"limits,omitempty"` + Provisioned bool `json:"provisioned,omitempty"` + SSHUser string `json:"sshUser,omitempty"` + SSHPrivateKey string `json:"sshPrivateKey,omitempty"` + ExtractedConfig string `json:"extractedConfig,omitempty"` + Address string `json:"address,omitempty"` + NodeConfig *RKEConfigNode `json:"nodeConfig,omitempty"` } type MachineCondition struct { @@ -93,12 +99,137 @@ type MachineSpec struct { } type AmazonEC2Config struct { + AccessKey string `json:"accessKey,omitempty"` + + Ami string `json:"ami,omitempty"` + + BlockDurationMinutes string `json:"blockDurationMinutes,omitempty"` + + DeviceName string `json:"deviceName,omitempty"` + + Endpoint string `json:"endpoint,omitempty"` + + IamInstanceProfile string `json:"iamInstanceProfile,omitempty"` + + InsecureTransport bool `json:"insecureTransport,omitempty"` + + InstanceType string `json:"instanceType,omitempty"` + + KeypairName string `json:"keypairName,omitempty"` + + Monitoring bool `json:"monitoring,omitempty"` + + OpenPort []string `json:"openPort,omitempty"` + + PrivateAddressOnly bool `json:"privateAddressOnly,omitempty"` + + Region string `json:"region,omitempty"` + + RequestSpotInstance bool `json:"requestSpotInstance,omitempty"` + + Retries string `json:"retries,omitempty"` + + RootSize string `json:"rootSize,omitempty"` + + SecretKey string `json:"secretKey,omitempty"` + + SecurityGroup []string `json:"securityGroup,omitempty"` + + SessionToken string `json:"sessionToken,omitempty"` + + SpotPrice string `json:"spotPrice,omitempty"` + + SSHKeypath string `json:"sshKeypath,omitempty"` + + SSHUser string `json:"sshUser,omitempty"` + + SubnetID string `json:"subnetId,omitempty"` + + Tags string `json:"tags,omitempty"` + + UseEbsOptimizedInstance bool `json:"useEbsOptimizedInstance,omitempty"` + + UsePrivateAddress bool `json:"usePrivateAddress,omitempty"` + + Userdata string `json:"userdata,omitempty"` + + VolumeType string `json:"volumeType,omitempty"` + + VpcID string `json:"vpcId,omitempty"` + + Zone string `json:"zone,omitempty"` } type AzureConfig struct { + AvailabilitySet string `json:"availabilitySet,omitempty"` + + ClientID string `json:"clientId,omitempty"` + + ClientSecret string `json:"clientSecret,omitempty"` + + CustomData string `json:"customData,omitempty"` + + DNS string `json:"dns,omitempty"` + + DockerPort string `json:"dockerPort,omitempty"` + + Environment string `json:"environment,omitempty"` + + Image string `json:"image,omitempty"` + + Location string `json:"location,omitempty"` + + NoPublicIP bool `json:"noPublicIp,omitempty"` + + OpenPort []string `json:"openPort,omitempty"` + + PrivateIPAddress string `json:"privateIpAddress,omitempty"` + + ResourceGroup string `json:"resourceGroup,omitempty"` + + Size string `json:"size,omitempty"` + + SSHUser string `json:"sshUser,omitempty"` + + StaticPublicIP bool `json:"staticPublicIp,omitempty"` + + StorageType string `json:"storageType,omitempty"` + + Subnet string `json:"subnet,omitempty"` + + SubnetPrefix string `json:"subnetPrefix,omitempty"` + + SubscriptionID string `json:"subscriptionId,omitempty"` + + UsePrivateIP bool `json:"usePrivateIp,omitempty"` + + Vnet string `json:"vnet,omitempty"` } type DigitalOceanConfig struct { + AccessToken string `json:"accessToken,omitempty"` + + Backups bool `json:"backups,omitempty"` + + Image string `json:"image,omitempty"` + + Ipv6 bool `json:"ipv6,omitempty"` + + PrivateNetworking bool `json:"privateNetworking,omitempty"` + + Region string `json:"region,omitempty"` + + Size string `json:"size,omitempty"` + + SSHKeyFingerprint string `json:"sshKeyFingerprint,omitempty"` + + SSHKeyPath string `json:"sshKeyPath,omitempty"` + + SSHPort string `json:"sshPort,omitempty"` + + SSHUser string `json:"sshUser,omitempty"` + + Userdata string `json:"userdata,omitempty"` } type MachineCommonParams struct { @@ -145,13 +276,12 @@ type MachineDriverCondition struct { } type MachineDriverSpec struct { - DisplayName string `json:"displayName"` - Description string `json:"description"` - URL string `json:"url"` - ExternalID string `json:"externalId"` - Builtin bool `json:"builtin"` - DefaultActive bool `json:"defaultActive"` - ActivateOnCreate bool `json:"activateOnCreate"` - Checksum string `json:"checksum"` - UIURL string `json:"uiUrl"` + DisplayName string `json:"displayName"` + Description string `json:"description"` + URL string `json:"url"` + ExternalID string `json:"externalId"` + Builtin bool `json:"builtin"` + Active bool `json:"active"` + Checksum string `json:"checksum"` + UIURL string `json:"uiUrl"` } diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/rke_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/rke_types.go index a123fc35..e6239156 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/rke_types.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/rke_types.go @@ -8,16 +8,22 @@ type RancherKubernetesEngineConfig struct { // Network configuration used in the kubernetes cluster (flannel, calico) Network NetworkConfig `yaml:"network" json:"network,omitempty"` // Authentication configuration used in the cluster (default: x509) - Authentication AuthConfig `yaml:"auth" json:"auth,omitempty"` + Authentication AuthnConfig `yaml:"authentication" json:"authentication,omitempty"` // YAML manifest for user provided addons to be deployed on the cluster Addons string `yaml:"addons" json:"addons,omitempty"` // List of images used internally for proxy, cert downlaod and kubedns SystemImages map[string]string `yaml:"system_images" json:"systemImages,omitempty"` // SSH Private Key Path SSHKeyPath string `yaml:"ssh_key_path" json:"sshKeyPath,omitempty"` + // Authorization mode configuration used in the cluster + Authorization AuthzConfig `yaml:"authorization" json:"authorization,omitempty"` + // Enable/disable strict docker version checking + IgnoreDockerVersion bool `yaml:"ignore_docker_version" json:"ignoreDockerVersion"` } type RKEConfigNode struct { + // Name of the host provisioned via docker machine + MachineName string `yaml:"machine_name" json:"machineName, omitempty"` // IP or FQDN that is fully resolvable and used for SSH communication Address string `yaml:"address" json:"address,omitempty"` // Optional - Internal address that will be used for components communication @@ -107,9 +113,16 @@ type NetworkConfig struct { Options map[string]string `yaml:"options" json:"options,omitempty"` } -type AuthConfig struct { +type AuthnConfig struct { // Authentication strategy that will be used in kubernetes cluster Strategy string `yaml:"strategy" json:"strategy,omitempty"` // Authentication options Options map[string]string `yaml:"options" json:"options,omitempty"` } + +type AuthzConfig struct { + // Authorization mode used by kubernetes + Mode string `yaml:"mode" json:"mode,omitempty"` + // Authorization mode options + Options map[string]string `yaml:"options" json:"options,omitempty"` +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/schema_types.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/schema_types.go new file mode 100644 index 00000000..25613eac --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/schema_types.go @@ -0,0 +1,72 @@ +package v3 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type DynamicSchema struct { + metav1.TypeMeta `json:",inline"` + // Standard object’s metadata. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata + metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification of the desired behavior of the the cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Spec DynamicSchemaSpec `json:"spec"` + // Most recent observed status of the cluster. More info: + // https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status + Status DynamicSchemaStatus `json:"status"` +} + +type DynamicSchemaSpec struct { + PluralName string `json:"pluralName,omitempty"` + ResourceMethods []string `json:"resourceMethods,omitempty"` + ResourceFields map[string]Field `json:"resourceFields,omitempty"` + ResourceActions map[string]Action `json:"resourceActions,omitempty"` + CollectionMethods []string `json:"collectionMethods,omitempty"` + CollectionFields map[string]Field `json:"collectionFields,omitempty"` + CollectionActions map[string]Action `json:"collectionActions,omitempty"` + CollectionFilters map[string]Filter `json:"collectionFilters,omitempty"` + IncludeableLinks []string `json:"includeableLinks,omitempty"` +} + +type DynamicSchemaStatus struct { + Fake string `json:"fake,omitempty"` +} + +type Field struct { + Type string `json:"type,omitempty"` + Default Values `json:"default,omitempty"` + Unique bool `json:"unique,omitempty"` + Nullable bool `json:"nullable,omitempty"` + Create bool `json:"create,omitempty"` + Required bool `json:"required,omitempty"` + Update bool `json:"update,omitempty"` + MinLength int64 `json:"minLength,omitempty"` + MaxLength int64 `json:"maxLength,omitempty"` + Min int64 `json:"min,omitempty"` + Max int64 `json:"max,omitempty"` + Options []string `json:"options,omitempty"` + ValidChars string `json:"validChars,omitempty"` + InvalidChars string `json:"invalidChars,omitempty"` + Description string `json:"description,omitempty"` +} + +type Values struct { + StringValue string `json:"stringValue,omitempty"` + IntValue int `json:"intValue,omitempty"` + BoolValue bool `json:"boolValue,omitempty"` + StringSliceValue []string `json:"stringSliceValue,omitempty"` +} + +type Action struct { + Input string `json:"input,omitempty"` + Output string `json:"output,omitempty"` +} + +type Filter struct { + Modifiers []string `json:"modifiers,omitempty"` +} + +type ListOpts struct { + Filters map[string]string `json:"filters,omitempty"` +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_catalog_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_catalog_controller.go new file mode 100644 index 00000000..46982971 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_catalog_controller.go @@ -0,0 +1,193 @@ +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 ( + CatalogGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "Catalog", + } + CatalogResource = metav1.APIResource{ + Name: "catalogs", + SingularName: "catalog", + Namespaced: false, + Kind: CatalogGroupVersionKind.Kind, + } +) + +type CatalogList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Catalog +} + +type CatalogHandlerFunc func(key string, obj *Catalog) error + +type CatalogLister interface { + List(namespace string, selector labels.Selector) (ret []*Catalog, err error) + Get(namespace, name string) (*Catalog, error) +} + +type CatalogController interface { + Informer() cache.SharedIndexInformer + Lister() CatalogLister + AddHandler(handler CatalogHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type CatalogInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*Catalog) (*Catalog, error) + Get(name string, opts metav1.GetOptions) (*Catalog, error) + Update(*Catalog) (*Catalog, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*CatalogList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() CatalogController +} + +type catalogLister struct { + controller *catalogController +} + +func (l *catalogLister) List(namespace string, selector labels.Selector) (ret []*Catalog, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*Catalog)) + }) + return +} + +func (l *catalogLister) Get(namespace, name string) (*Catalog, 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: CatalogGroupVersionKind.Group, + Resource: "catalog", + }, name) + } + return obj.(*Catalog), nil +} + +type catalogController struct { + controller.GenericController +} + +func (c *catalogController) Lister() CatalogLister { + return &catalogLister{ + controller: c, + } +} + +func (c *catalogController) AddHandler(handler CatalogHandlerFunc) { + c.GenericController.AddHandler(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.(*Catalog)) + }) +} + +type catalogFactory struct { +} + +func (c catalogFactory) Object() runtime.Object { + return &Catalog{} +} + +func (c catalogFactory) List() runtime.Object { + return &CatalogList{} +} + +func (s *catalogClient) Controller() CatalogController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.catalogControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(CatalogGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &catalogController{ + GenericController: genericController, + } + + s.client.catalogControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type catalogClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller CatalogController +} + +func (s *catalogClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *catalogClient) Create(o *Catalog) (*Catalog, error) { + obj, err := s.objectClient.Create(o) + return obj.(*Catalog), err +} + +func (s *catalogClient) Get(name string, opts metav1.GetOptions) (*Catalog, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*Catalog), err +} + +func (s *catalogClient) Update(o *Catalog) (*Catalog, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*Catalog), err +} + +func (s *catalogClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *catalogClient) List(opts metav1.ListOptions) (*CatalogList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*CatalogList), err +} + +func (s *catalogClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *catalogClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_catalog_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_catalog_lifecycle_adapter.go new file mode 100644 index 00000000..b2d5a4cf --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_catalog_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type CatalogLifecycle interface { + Create(obj *Catalog) (*Catalog, error) + Remove(obj *Catalog) (*Catalog, error) + Updated(obj *Catalog) (*Catalog, error) +} + +type catalogLifecycleAdapter struct { + lifecycle CatalogLifecycle +} + +func (w *catalogLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*Catalog)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *catalogLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*Catalog)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *catalogLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*Catalog)) + if o == nil { + return nil, err + } + return o, err +} + +func NewCatalogLifecycleAdapter(name string, client CatalogInterface, l CatalogLifecycle) CatalogHandlerFunc { + adapter := &catalogLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *Catalog) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_controller.go index 93de9350..61bfd0d0 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_controller.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_controller.go @@ -74,7 +74,13 @@ func (l *clusterLister) List(namespace string, selector labels.Selector) (ret [] } func (l *clusterLister) Get(namespace, name string) (*Cluster, error) { - obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name) + 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 } diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_event_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_event_controller.go new file mode 100644 index 00000000..cc8226c4 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_event_controller.go @@ -0,0 +1,193 @@ +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 ( + ClusterEventGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "ClusterEvent", + } + ClusterEventResource = metav1.APIResource{ + Name: "clusterevents", + SingularName: "clusterevent", + Namespaced: false, + Kind: ClusterEventGroupVersionKind.Kind, + } +) + +type ClusterEventList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterEvent +} + +type ClusterEventHandlerFunc func(key string, obj *ClusterEvent) error + +type ClusterEventLister interface { + List(namespace string, selector labels.Selector) (ret []*ClusterEvent, err error) + Get(namespace, name string) (*ClusterEvent, error) +} + +type ClusterEventController interface { + Informer() cache.SharedIndexInformer + Lister() ClusterEventLister + AddHandler(handler ClusterEventHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type ClusterEventInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*ClusterEvent) (*ClusterEvent, error) + Get(name string, opts metav1.GetOptions) (*ClusterEvent, error) + Update(*ClusterEvent) (*ClusterEvent, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*ClusterEventList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() ClusterEventController +} + +type clusterEventLister struct { + controller *clusterEventController +} + +func (l *clusterEventLister) List(namespace string, selector labels.Selector) (ret []*ClusterEvent, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*ClusterEvent)) + }) + return +} + +func (l *clusterEventLister) Get(namespace, name string) (*ClusterEvent, 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: ClusterEventGroupVersionKind.Group, + Resource: "clusterEvent", + }, name) + } + return obj.(*ClusterEvent), nil +} + +type clusterEventController struct { + controller.GenericController +} + +func (c *clusterEventController) Lister() ClusterEventLister { + return &clusterEventLister{ + controller: c, + } +} + +func (c *clusterEventController) AddHandler(handler ClusterEventHandlerFunc) { + c.GenericController.AddHandler(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.(*ClusterEvent)) + }) +} + +type clusterEventFactory struct { +} + +func (c clusterEventFactory) Object() runtime.Object { + return &ClusterEvent{} +} + +func (c clusterEventFactory) List() runtime.Object { + return &ClusterEventList{} +} + +func (s *clusterEventClient) Controller() ClusterEventController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.clusterEventControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(ClusterEventGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &clusterEventController{ + GenericController: genericController, + } + + s.client.clusterEventControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type clusterEventClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller ClusterEventController +} + +func (s *clusterEventClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *clusterEventClient) Create(o *ClusterEvent) (*ClusterEvent, error) { + obj, err := s.objectClient.Create(o) + return obj.(*ClusterEvent), err +} + +func (s *clusterEventClient) Get(name string, opts metav1.GetOptions) (*ClusterEvent, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*ClusterEvent), err +} + +func (s *clusterEventClient) Update(o *ClusterEvent) (*ClusterEvent, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*ClusterEvent), err +} + +func (s *clusterEventClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *clusterEventClient) List(opts metav1.ListOptions) (*ClusterEventList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*ClusterEventList), err +} + +func (s *clusterEventClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *clusterEventClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_event_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_event_lifecycle_adapter.go new file mode 100644 index 00000000..291b92f7 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_event_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type ClusterEventLifecycle interface { + Create(obj *ClusterEvent) (*ClusterEvent, error) + Remove(obj *ClusterEvent) (*ClusterEvent, error) + Updated(obj *ClusterEvent) (*ClusterEvent, error) +} + +type clusterEventLifecycleAdapter struct { + lifecycle ClusterEventLifecycle +} + +func (w *clusterEventLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ClusterEvent)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *clusterEventLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ClusterEvent)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *clusterEventLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ClusterEvent)) + if o == nil { + return nil, err + } + return o, err +} + +func NewClusterEventLifecycleAdapter(name string, client ClusterEventInterface, l ClusterEventLifecycle) ClusterEventHandlerFunc { + adapter := &clusterEventLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *ClusterEvent) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_lifecycle_adapter.go index 5c12361d..6b4d67d0 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_lifecycle_adapter.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_lifecycle_adapter.go @@ -6,25 +6,37 @@ import ( ) type ClusterLifecycle interface { - Initialize(obj *Cluster) error - Remove(obj *Cluster) error - Updated(obj *Cluster) error + Create(obj *Cluster) (*Cluster, error) + Remove(obj *Cluster) (*Cluster, error) + Updated(obj *Cluster) (*Cluster, error) } type clusterLifecycleAdapter struct { lifecycle ClusterLifecycle } -func (w *clusterLifecycleAdapter) Initialize(obj runtime.Object) error { - return w.lifecycle.Initialize(obj.(*Cluster)) +func (w *clusterLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*Cluster)) + if o == nil { + return nil, err + } + return o, err } -func (w *clusterLifecycleAdapter) Finalize(obj runtime.Object) error { - return w.lifecycle.Remove(obj.(*Cluster)) +func (w *clusterLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*Cluster)) + if o == nil { + return nil, err + } + return o, err } -func (w *clusterLifecycleAdapter) Updated(obj runtime.Object) error { - return w.lifecycle.Updated(obj.(*Cluster)) +func (w *clusterLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*Cluster)) + if o == nil { + return nil, err + } + return o, err } func NewClusterLifecycleAdapter(name string, client ClusterInterface, l ClusterLifecycle) ClusterHandlerFunc { diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_registration_token_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_registration_token_controller.go new file mode 100644 index 00000000..06ed8312 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_registration_token_controller.go @@ -0,0 +1,193 @@ +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 ( + ClusterRegistrationTokenGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "ClusterRegistrationToken", + } + ClusterRegistrationTokenResource = metav1.APIResource{ + Name: "clusterregistrationtokens", + SingularName: "clusterregistrationtoken", + Namespaced: false, + Kind: ClusterRegistrationTokenGroupVersionKind.Kind, + } +) + +type ClusterRegistrationTokenList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterRegistrationToken +} + +type ClusterRegistrationTokenHandlerFunc func(key string, obj *ClusterRegistrationToken) error + +type ClusterRegistrationTokenLister interface { + List(namespace string, selector labels.Selector) (ret []*ClusterRegistrationToken, err error) + Get(namespace, name string) (*ClusterRegistrationToken, error) +} + +type ClusterRegistrationTokenController interface { + Informer() cache.SharedIndexInformer + Lister() ClusterRegistrationTokenLister + AddHandler(handler ClusterRegistrationTokenHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type ClusterRegistrationTokenInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*ClusterRegistrationToken) (*ClusterRegistrationToken, error) + Get(name string, opts metav1.GetOptions) (*ClusterRegistrationToken, error) + Update(*ClusterRegistrationToken) (*ClusterRegistrationToken, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*ClusterRegistrationTokenList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() ClusterRegistrationTokenController +} + +type clusterRegistrationTokenLister struct { + controller *clusterRegistrationTokenController +} + +func (l *clusterRegistrationTokenLister) List(namespace string, selector labels.Selector) (ret []*ClusterRegistrationToken, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*ClusterRegistrationToken)) + }) + return +} + +func (l *clusterRegistrationTokenLister) Get(namespace, name string) (*ClusterRegistrationToken, 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: ClusterRegistrationTokenGroupVersionKind.Group, + Resource: "clusterRegistrationToken", + }, name) + } + return obj.(*ClusterRegistrationToken), nil +} + +type clusterRegistrationTokenController struct { + controller.GenericController +} + +func (c *clusterRegistrationTokenController) Lister() ClusterRegistrationTokenLister { + return &clusterRegistrationTokenLister{ + controller: c, + } +} + +func (c *clusterRegistrationTokenController) AddHandler(handler ClusterRegistrationTokenHandlerFunc) { + c.GenericController.AddHandler(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.(*ClusterRegistrationToken)) + }) +} + +type clusterRegistrationTokenFactory struct { +} + +func (c clusterRegistrationTokenFactory) Object() runtime.Object { + return &ClusterRegistrationToken{} +} + +func (c clusterRegistrationTokenFactory) List() runtime.Object { + return &ClusterRegistrationTokenList{} +} + +func (s *clusterRegistrationTokenClient) Controller() ClusterRegistrationTokenController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.clusterRegistrationTokenControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(ClusterRegistrationTokenGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &clusterRegistrationTokenController{ + GenericController: genericController, + } + + s.client.clusterRegistrationTokenControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type clusterRegistrationTokenClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller ClusterRegistrationTokenController +} + +func (s *clusterRegistrationTokenClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *clusterRegistrationTokenClient) Create(o *ClusterRegistrationToken) (*ClusterRegistrationToken, error) { + obj, err := s.objectClient.Create(o) + return obj.(*ClusterRegistrationToken), err +} + +func (s *clusterRegistrationTokenClient) Get(name string, opts metav1.GetOptions) (*ClusterRegistrationToken, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*ClusterRegistrationToken), err +} + +func (s *clusterRegistrationTokenClient) Update(o *ClusterRegistrationToken) (*ClusterRegistrationToken, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*ClusterRegistrationToken), err +} + +func (s *clusterRegistrationTokenClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *clusterRegistrationTokenClient) List(opts metav1.ListOptions) (*ClusterRegistrationTokenList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*ClusterRegistrationTokenList), err +} + +func (s *clusterRegistrationTokenClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *clusterRegistrationTokenClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_registration_token_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_registration_token_lifecycle_adapter.go new file mode 100644 index 00000000..8a2d3b2c --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_registration_token_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type ClusterRegistrationTokenLifecycle interface { + Create(obj *ClusterRegistrationToken) (*ClusterRegistrationToken, error) + Remove(obj *ClusterRegistrationToken) (*ClusterRegistrationToken, error) + Updated(obj *ClusterRegistrationToken) (*ClusterRegistrationToken, error) +} + +type clusterRegistrationTokenLifecycleAdapter struct { + lifecycle ClusterRegistrationTokenLifecycle +} + +func (w *clusterRegistrationTokenLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ClusterRegistrationToken)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *clusterRegistrationTokenLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ClusterRegistrationToken)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *clusterRegistrationTokenLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ClusterRegistrationToken)) + if o == nil { + return nil, err + } + return o, err +} + +func NewClusterRegistrationTokenLifecycleAdapter(name string, client ClusterRegistrationTokenInterface, l ClusterRegistrationTokenLifecycle) ClusterRegistrationTokenHandlerFunc { + adapter := &clusterRegistrationTokenLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *ClusterRegistrationToken) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_role_template_binding_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_role_template_binding_controller.go index 82a59dd0..1769e6dd 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_role_template_binding_controller.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_role_template_binding_controller.go @@ -74,7 +74,13 @@ func (l *clusterRoleTemplateBindingLister) List(namespace string, selector label } func (l *clusterRoleTemplateBindingLister) Get(namespace, name string) (*ClusterRoleTemplateBinding, error) { - obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name) + 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 } diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_role_template_binding_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_role_template_binding_lifecycle_adapter.go index 4f52c7c7..14ce8d70 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_role_template_binding_lifecycle_adapter.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_role_template_binding_lifecycle_adapter.go @@ -6,25 +6,37 @@ import ( ) type ClusterRoleTemplateBindingLifecycle interface { - Initialize(obj *ClusterRoleTemplateBinding) error - Remove(obj *ClusterRoleTemplateBinding) error - Updated(obj *ClusterRoleTemplateBinding) error + Create(obj *ClusterRoleTemplateBinding) (*ClusterRoleTemplateBinding, error) + Remove(obj *ClusterRoleTemplateBinding) (*ClusterRoleTemplateBinding, error) + Updated(obj *ClusterRoleTemplateBinding) (*ClusterRoleTemplateBinding, error) } type clusterRoleTemplateBindingLifecycleAdapter struct { lifecycle ClusterRoleTemplateBindingLifecycle } -func (w *clusterRoleTemplateBindingLifecycleAdapter) Initialize(obj runtime.Object) error { - return w.lifecycle.Initialize(obj.(*ClusterRoleTemplateBinding)) +func (w *clusterRoleTemplateBindingLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ClusterRoleTemplateBinding)) + if o == nil { + return nil, err + } + return o, err } -func (w *clusterRoleTemplateBindingLifecycleAdapter) Finalize(obj runtime.Object) error { - return w.lifecycle.Remove(obj.(*ClusterRoleTemplateBinding)) +func (w *clusterRoleTemplateBindingLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ClusterRoleTemplateBinding)) + if o == nil { + return nil, err + } + return o, err } -func (w *clusterRoleTemplateBindingLifecycleAdapter) Updated(obj runtime.Object) error { - return w.lifecycle.Updated(obj.(*ClusterRoleTemplateBinding)) +func (w *clusterRoleTemplateBindingLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ClusterRoleTemplateBinding)) + if o == nil { + return nil, err + } + return o, err } func NewClusterRoleTemplateBindingLifecycleAdapter(name string, client ClusterRoleTemplateBindingInterface, l ClusterRoleTemplateBindingLifecycle) ClusterRoleTemplateBindingHandlerFunc { diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_role_template_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_role_template_controller.go deleted file mode 100644 index bbc6aded..00000000 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_role_template_controller.go +++ /dev/null @@ -1,187 +0,0 @@ -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 ( - ClusterRoleTemplateGroupVersionKind = schema.GroupVersionKind{ - Version: "v3", - Group: "management.cattle.io", - Kind: "ClusterRoleTemplate", - } - ClusterRoleTemplateResource = metav1.APIResource{ - Name: "clusterroletemplates", - SingularName: "clusterroletemplate", - Namespaced: false, - Kind: ClusterRoleTemplateGroupVersionKind.Kind, - } -) - -type ClusterRoleTemplateList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ClusterRoleTemplate -} - -type ClusterRoleTemplateHandlerFunc func(key string, obj *ClusterRoleTemplate) error - -type ClusterRoleTemplateLister interface { - List(namespace string, selector labels.Selector) (ret []*ClusterRoleTemplate, err error) - Get(namespace, name string) (*ClusterRoleTemplate, error) -} - -type ClusterRoleTemplateController interface { - Informer() cache.SharedIndexInformer - Lister() ClusterRoleTemplateLister - AddHandler(handler ClusterRoleTemplateHandlerFunc) - Enqueue(namespace, name string) - Sync(ctx context.Context) error - Start(ctx context.Context, threadiness int) error -} - -type ClusterRoleTemplateInterface interface { - ObjectClient() *clientbase.ObjectClient - Create(*ClusterRoleTemplate) (*ClusterRoleTemplate, error) - Get(name string, opts metav1.GetOptions) (*ClusterRoleTemplate, error) - Update(*ClusterRoleTemplate) (*ClusterRoleTemplate, error) - Delete(name string, options *metav1.DeleteOptions) error - List(opts metav1.ListOptions) (*ClusterRoleTemplateList, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error - Controller() ClusterRoleTemplateController -} - -type clusterRoleTemplateLister struct { - controller *clusterRoleTemplateController -} - -func (l *clusterRoleTemplateLister) List(namespace string, selector labels.Selector) (ret []*ClusterRoleTemplate, err error) { - err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { - ret = append(ret, obj.(*ClusterRoleTemplate)) - }) - return -} - -func (l *clusterRoleTemplateLister) Get(namespace, name string) (*ClusterRoleTemplate, error) { - obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(schema.GroupResource{ - Group: ClusterRoleTemplateGroupVersionKind.Group, - Resource: "clusterRoleTemplate", - }, name) - } - return obj.(*ClusterRoleTemplate), nil -} - -type clusterRoleTemplateController struct { - controller.GenericController -} - -func (c *clusterRoleTemplateController) Lister() ClusterRoleTemplateLister { - return &clusterRoleTemplateLister{ - controller: c, - } -} - -func (c *clusterRoleTemplateController) AddHandler(handler ClusterRoleTemplateHandlerFunc) { - c.GenericController.AddHandler(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.(*ClusterRoleTemplate)) - }) -} - -type clusterRoleTemplateFactory struct { -} - -func (c clusterRoleTemplateFactory) Object() runtime.Object { - return &ClusterRoleTemplate{} -} - -func (c clusterRoleTemplateFactory) List() runtime.Object { - return &ClusterRoleTemplateList{} -} - -func (s *clusterRoleTemplateClient) Controller() ClusterRoleTemplateController { - s.client.Lock() - defer s.client.Unlock() - - c, ok := s.client.clusterRoleTemplateControllers[s.ns] - if ok { - return c - } - - genericController := controller.NewGenericController(ClusterRoleTemplateGroupVersionKind.Kind+"Controller", - s.objectClient) - - c = &clusterRoleTemplateController{ - GenericController: genericController, - } - - s.client.clusterRoleTemplateControllers[s.ns] = c - s.client.starters = append(s.client.starters, c) - - return c -} - -type clusterRoleTemplateClient struct { - client *Client - ns string - objectClient *clientbase.ObjectClient - controller ClusterRoleTemplateController -} - -func (s *clusterRoleTemplateClient) ObjectClient() *clientbase.ObjectClient { - return s.objectClient -} - -func (s *clusterRoleTemplateClient) Create(o *ClusterRoleTemplate) (*ClusterRoleTemplate, error) { - obj, err := s.objectClient.Create(o) - return obj.(*ClusterRoleTemplate), err -} - -func (s *clusterRoleTemplateClient) Get(name string, opts metav1.GetOptions) (*ClusterRoleTemplate, error) { - obj, err := s.objectClient.Get(name, opts) - return obj.(*ClusterRoleTemplate), err -} - -func (s *clusterRoleTemplateClient) Update(o *ClusterRoleTemplate) (*ClusterRoleTemplate, error) { - obj, err := s.objectClient.Update(o.Name, o) - return obj.(*ClusterRoleTemplate), err -} - -func (s *clusterRoleTemplateClient) Delete(name string, options *metav1.DeleteOptions) error { - return s.objectClient.Delete(name, options) -} - -func (s *clusterRoleTemplateClient) List(opts metav1.ListOptions) (*ClusterRoleTemplateList, error) { - obj, err := s.objectClient.List(opts) - return obj.(*ClusterRoleTemplateList), err -} - -func (s *clusterRoleTemplateClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { - return s.objectClient.Watch(opts) -} - -func (s *clusterRoleTemplateClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return s.objectClient.DeleteCollection(deleteOpts, listOpts) -} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_role_template_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_role_template_lifecycle_adapter.go deleted file mode 100644 index 3e85b211..00000000 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_cluster_role_template_lifecycle_adapter.go +++ /dev/null @@ -1,39 +0,0 @@ -package v3 - -import ( - "github.com/rancher/norman/lifecycle" - "k8s.io/apimachinery/pkg/runtime" -) - -type ClusterRoleTemplateLifecycle interface { - Initialize(obj *ClusterRoleTemplate) error - Remove(obj *ClusterRoleTemplate) error - Updated(obj *ClusterRoleTemplate) error -} - -type clusterRoleTemplateLifecycleAdapter struct { - lifecycle ClusterRoleTemplateLifecycle -} - -func (w *clusterRoleTemplateLifecycleAdapter) Initialize(obj runtime.Object) error { - return w.lifecycle.Initialize(obj.(*ClusterRoleTemplate)) -} - -func (w *clusterRoleTemplateLifecycleAdapter) Finalize(obj runtime.Object) error { - return w.lifecycle.Remove(obj.(*ClusterRoleTemplate)) -} - -func (w *clusterRoleTemplateLifecycleAdapter) Updated(obj runtime.Object) error { - return w.lifecycle.Updated(obj.(*ClusterRoleTemplate)) -} - -func NewClusterRoleTemplateLifecycleAdapter(name string, client ClusterRoleTemplateInterface, l ClusterRoleTemplateLifecycle) ClusterRoleTemplateHandlerFunc { - adapter := &clusterRoleTemplateLifecycleAdapter{lifecycle: l} - syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) - return func(key string, obj *ClusterRoleTemplate) error { - if obj == nil { - return syncFn(key, nil) - } - return syncFn(key, obj) - } -} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_deepcopy.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_deepcopy.go index 311e0083..243a915b 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_deepcopy.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_deepcopy.go @@ -6,9 +6,35 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Action) DeepCopyInto(out *Action) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Action. +func (in *Action) DeepCopy() *Action { + if in == nil { + return nil + } + out := new(Action) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AmazonEC2Config) DeepCopyInto(out *AmazonEC2Config) { *out = *in + if in.OpenPort != nil { + in, out := &in.OpenPort, &out.OpenPort + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.SecurityGroup != nil { + in, out := &in.SecurityGroup, &out.SecurityGroup + *out = make([]string, len(*in)) + copy(*out, *in) + } return } @@ -23,7 +49,7 @@ func (in *AmazonEC2Config) DeepCopy() *AmazonEC2Config { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AuthConfig) DeepCopyInto(out *AuthConfig) { +func (in *AuthnConfig) DeepCopyInto(out *AuthnConfig) { *out = *in if in.Options != nil { in, out := &in.Options, &out.Options @@ -35,12 +61,35 @@ func (in *AuthConfig) DeepCopyInto(out *AuthConfig) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthConfig. -func (in *AuthConfig) DeepCopy() *AuthConfig { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthnConfig. +func (in *AuthnConfig) DeepCopy() *AuthnConfig { if in == nil { return nil } - out := new(AuthConfig) + out := new(AuthnConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AuthzConfig) DeepCopyInto(out *AuthzConfig) { + *out = *in + if in.Options != nil { + in, out := &in.Options, &out.Options + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthzConfig. +func (in *AuthzConfig) DeepCopy() *AuthzConfig { + if in == nil { + return nil + } + out := new(AuthzConfig) in.DeepCopyInto(out) return out } @@ -48,6 +97,11 @@ func (in *AuthConfig) DeepCopy() *AuthConfig { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AzureConfig) DeepCopyInto(out *AzureConfig) { *out = *in + if in.OpenPort != nil { + in, out := &in.OpenPort, &out.OpenPort + *out = make([]string, len(*in)) + copy(*out, *in) + } return } @@ -100,6 +154,101 @@ func (in *BaseService) DeepCopy() *BaseService { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Catalog) DeepCopyInto(out *Catalog) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Catalog. +func (in *Catalog) DeepCopy() *Catalog { + if in == nil { + return nil + } + out := new(Catalog) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Catalog) 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 *CatalogList) DeepCopyInto(out *CatalogList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Catalog, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogList. +func (in *CatalogList) DeepCopy() *CatalogList { + if in == nil { + return nil + } + out := new(CatalogList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CatalogList) 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 *CatalogSpec) DeepCopyInto(out *CatalogSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogSpec. +func (in *CatalogSpec) DeepCopy() *CatalogSpec { + if in == nil { + return nil + } + out := new(CatalogSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CatalogStatus) DeepCopyInto(out *CatalogStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogStatus. +func (in *CatalogStatus) DeepCopy() *CatalogStatus { + if in == nil { + return nil + } + out := new(CatalogStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Cluster) DeepCopyInto(out *Cluster) { *out = *in @@ -166,6 +315,66 @@ func (in *ClusterCondition) DeepCopy() *ClusterCondition { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterEvent) DeepCopyInto(out *ClusterEvent) { + *out = *in + in.Event.DeepCopyInto(&out.Event) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterEvent. +func (in *ClusterEvent) DeepCopy() *ClusterEvent { + if in == nil { + return nil + } + out := new(ClusterEvent) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterEvent) 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 *ClusterEventList) DeepCopyInto(out *ClusterEventList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterEvent, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterEventList. +func (in *ClusterEventList) DeepCopy() *ClusterEventList { + if in == nil { + return nil + } + out := new(ClusterEventList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterEventList) 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 *ClusterList) DeepCopyInto(out *ClusterList) { *out = *in @@ -201,37 +410,27 @@ func (in *ClusterList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterRoleTemplate) DeepCopyInto(out *ClusterRoleTemplate) { +func (in *ClusterRegistrationToken) DeepCopyInto(out *ClusterRegistrationToken) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - if in.Rules != nil { - in, out := &in.Rules, &out.Rules - *out = make([]rbac_v1.PolicyRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ClusterRoleTemplateNames != nil { - in, out := &in.ClusterRoleTemplateNames, &out.ClusterRoleTemplateNames - *out = make([]string, len(*in)) - copy(*out, *in) - } + out.Spec = in.Spec + out.Status = in.Status return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRoleTemplate. -func (in *ClusterRoleTemplate) DeepCopy() *ClusterRoleTemplate { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRegistrationToken. +func (in *ClusterRegistrationToken) DeepCopy() *ClusterRegistrationToken { if in == nil { return nil } - out := new(ClusterRoleTemplate) + out := new(ClusterRegistrationToken) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ClusterRoleTemplate) DeepCopyObject() runtime.Object { +func (in *ClusterRegistrationToken) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } else { @@ -239,6 +438,72 @@ func (in *ClusterRoleTemplate) DeepCopyObject() runtime.Object { } } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterRegistrationTokenList) DeepCopyInto(out *ClusterRegistrationTokenList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterRegistrationToken, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRegistrationTokenList. +func (in *ClusterRegistrationTokenList) DeepCopy() *ClusterRegistrationTokenList { + if in == nil { + return nil + } + out := new(ClusterRegistrationTokenList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterRegistrationTokenList) 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 *ClusterRegistrationTokenSpec) DeepCopyInto(out *ClusterRegistrationTokenSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRegistrationTokenSpec. +func (in *ClusterRegistrationTokenSpec) DeepCopy() *ClusterRegistrationTokenSpec { + if in == nil { + return nil + } + out := new(ClusterRegistrationTokenSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterRegistrationTokenStatus) DeepCopyInto(out *ClusterRegistrationTokenStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRegistrationTokenStatus. +func (in *ClusterRegistrationTokenStatus) DeepCopy() *ClusterRegistrationTokenStatus { + if in == nil { + return nil + } + out := new(ClusterRegistrationTokenStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterRoleTemplateBinding) DeepCopyInto(out *ClusterRoleTemplateBinding) { *out = *in @@ -301,40 +566,6 @@ func (in *ClusterRoleTemplateBindingList) DeepCopyObject() runtime.Object { } } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterRoleTemplateList) DeepCopyInto(out *ClusterRoleTemplateList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ClusterRoleTemplate, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRoleTemplateList. -func (in *ClusterRoleTemplateList) DeepCopy() *ClusterRoleTemplateList { - if in == nil { - return nil - } - out := new(ClusterRoleTemplateList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ClusterRoleTemplateList) 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 *ClusterSpec) DeepCopyInto(out *ClusterSpec) { *out = *in @@ -451,6 +682,151 @@ func (in *DigitalOceanConfig) DeepCopy() *DigitalOceanConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DynamicSchema) DeepCopyInto(out *DynamicSchema) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DynamicSchema. +func (in *DynamicSchema) DeepCopy() *DynamicSchema { + if in == nil { + return nil + } + out := new(DynamicSchema) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DynamicSchema) 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 *DynamicSchemaList) DeepCopyInto(out *DynamicSchemaList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DynamicSchema, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DynamicSchemaList. +func (in *DynamicSchemaList) DeepCopy() *DynamicSchemaList { + if in == nil { + return nil + } + out := new(DynamicSchemaList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DynamicSchemaList) 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 *DynamicSchemaSpec) DeepCopyInto(out *DynamicSchemaSpec) { + *out = *in + if in.ResourceMethods != nil { + in, out := &in.ResourceMethods, &out.ResourceMethods + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ResourceFields != nil { + in, out := &in.ResourceFields, &out.ResourceFields + *out = make(map[string]Field, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.ResourceActions != nil { + in, out := &in.ResourceActions, &out.ResourceActions + *out = make(map[string]Action, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.CollectionMethods != nil { + in, out := &in.CollectionMethods, &out.CollectionMethods + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.CollectionFields != nil { + in, out := &in.CollectionFields, &out.CollectionFields + *out = make(map[string]Field, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.CollectionActions != nil { + in, out := &in.CollectionActions, &out.CollectionActions + *out = make(map[string]Action, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.CollectionFilters != nil { + in, out := &in.CollectionFilters, &out.CollectionFilters + *out = make(map[string]Filter, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.IncludeableLinks != nil { + in, out := &in.IncludeableLinks, &out.IncludeableLinks + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DynamicSchemaSpec. +func (in *DynamicSchemaSpec) DeepCopy() *DynamicSchemaSpec { + if in == nil { + return nil + } + out := new(DynamicSchemaSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DynamicSchemaStatus) DeepCopyInto(out *DynamicSchemaStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DynamicSchemaStatus. +func (in *DynamicSchemaStatus) DeepCopy() *DynamicSchemaStatus { + if in == nil { + return nil + } + out := new(DynamicSchemaStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ETCDService) DeepCopyInto(out *ETCDService) { *out = *in @@ -468,6 +844,81 @@ func (in *ETCDService) DeepCopy() *ETCDService { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Field) DeepCopyInto(out *Field) { + *out = *in + in.Default.DeepCopyInto(&out.Default) + if in.Options != nil { + in, out := &in.Options, &out.Options + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Field. +func (in *Field) DeepCopy() *Field { + if in == nil { + return nil + } + out := new(Field) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *File) DeepCopyInto(out *File) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new File. +func (in *File) DeepCopy() *File { + if in == nil { + return nil + } + out := new(File) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Filter) DeepCopyInto(out *Filter) { + *out = *in + if in.Modifiers != nil { + in, out := &in.Modifiers, &out.Modifiers + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Filter. +func (in *Filter) DeepCopy() *Filter { + if in == nil { + return nil + } + out := new(Filter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GithubCredential) DeepCopyInto(out *GithubCredential) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GithubCredential. +func (in *GithubCredential) DeepCopy() *GithubCredential { + if in == nil { + return nil + } + out := new(GithubCredential) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GoogleKubernetesEngineConfig) DeepCopyInto(out *GoogleKubernetesEngineConfig) { *out = *in @@ -478,6 +929,11 @@ func (in *GoogleKubernetesEngineConfig) DeepCopyInto(out *GoogleKubernetesEngine (*out)[key] = val } } + if in.Locations != nil { + in, out := &in.Locations, &out.Locations + *out = make([]string, len(*in)) + copy(*out, *in) + } return } @@ -491,6 +947,196 @@ func (in *GoogleKubernetesEngineConfig) DeepCopy() *GoogleKubernetesEngineConfig return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Group) DeepCopyInto(out *Group) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Group. +func (in *Group) DeepCopy() *Group { + if in == nil { + return nil + } + out := new(Group) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Group) 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 *GroupList) DeepCopyInto(out *GroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Group, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupList. +func (in *GroupList) DeepCopy() *GroupList { + if in == nil { + return nil + } + out := new(GroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GroupList) 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 *GroupMember) DeepCopyInto(out *GroupMember) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupMember. +func (in *GroupMember) DeepCopy() *GroupMember { + if in == nil { + return nil + } + out := new(GroupMember) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GroupMember) 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 *GroupMemberList) DeepCopyInto(out *GroupMemberList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GroupMember, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupMemberList. +func (in *GroupMemberList) DeepCopy() *GroupMemberList { + if in == nil { + return nil + } + out := new(GroupMemberList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GroupMemberList) 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 *Identity) DeepCopyInto(out *Identity) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.ExtraInfo != nil { + in, out := &in.ExtraInfo, &out.ExtraInfo + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Identity. +func (in *Identity) DeepCopy() *Identity { + if in == nil { + return nil + } + out := new(Identity) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Identity) 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 *IdentityList) DeepCopyInto(out *IdentityList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Identity, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IdentityList. +func (in *IdentityList) DeepCopy() *IdentityList { + if in == nil { + return nil + } + out := new(IdentityList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *IdentityList) 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 *KubeAPIService) DeepCopyInto(out *KubeAPIService) { *out = *in @@ -559,6 +1205,63 @@ func (in *KubeproxyService) DeepCopy() *KubeproxyService { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ListOpts) DeepCopyInto(out *ListOpts) { + *out = *in + if in.Filters != nil { + in, out := &in.Filters, &out.Filters + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListOpts. +func (in *ListOpts) DeepCopy() *ListOpts { + if in == nil { + return nil + } + out := new(ListOpts) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LocalCredential) DeepCopyInto(out *LocalCredential) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalCredential. +func (in *LocalCredential) DeepCopy() *LocalCredential { + if in == nil { + return nil + } + out := new(LocalCredential) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoginInput) DeepCopyInto(out *LoginInput) { + *out = *in + out.LocalCredential = in.LocalCredential + out.GithubCredential = in.GithubCredential + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoginInput. +func (in *LoginInput) DeepCopy() *LoginInput { + if in == nil { + return nil + } + out := new(LoginInput) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Machine) DeepCopyInto(out *Machine) { *out = *in @@ -806,8 +1509,8 @@ func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { *out = *in in.NodeSpec.DeepCopyInto(&out.NodeSpec) in.MachineCommonParams.DeepCopyInto(&out.MachineCommonParams) - out.AmazonEC2Config = in.AmazonEC2Config - out.AzureConfig = in.AzureConfig + in.AmazonEC2Config.DeepCopyInto(&out.AmazonEC2Config) + in.AzureConfig.DeepCopyInto(&out.AzureConfig) out.DigitalOceanConfig = in.DigitalOceanConfig return } @@ -845,6 +1548,15 @@ func (in *MachineStatus) DeepCopyInto(out *MachineStatus) { (*out)[key] = val.DeepCopy() } } + if in.NodeConfig != nil { + in, out := &in.NodeConfig, &out.NodeConfig + if *in == nil { + *out = nil + } else { + *out = new(RKEConfigNode) + (*in).DeepCopyInto(*out) + } + } return } @@ -1135,45 +1847,6 @@ func (in *ProjectList) DeepCopyObject() runtime.Object { } } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ProjectRoleTemplate) DeepCopyInto(out *ProjectRoleTemplate) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - if in.Rules != nil { - in, out := &in.Rules, &out.Rules - *out = make([]rbac_v1.PolicyRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ProjectRoleTemplateNames != nil { - in, out := &in.ProjectRoleTemplateNames, &out.ProjectRoleTemplateNames - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectRoleTemplate. -func (in *ProjectRoleTemplate) DeepCopy() *ProjectRoleTemplate { - if in == nil { - return nil - } - out := new(ProjectRoleTemplate) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ProjectRoleTemplate) 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 *ProjectRoleTemplateBinding) DeepCopyInto(out *ProjectRoleTemplateBinding) { *out = *in @@ -1236,40 +1909,6 @@ func (in *ProjectRoleTemplateBindingList) DeepCopyObject() runtime.Object { } } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ProjectRoleTemplateList) DeepCopyInto(out *ProjectRoleTemplateList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ProjectRoleTemplate, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectRoleTemplateList. -func (in *ProjectRoleTemplateList) DeepCopy() *ProjectRoleTemplateList { - if in == nil { - return nil - } - out := new(ProjectRoleTemplateList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ProjectRoleTemplateList) 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 *ProjectSpec) DeepCopyInto(out *ProjectSpec) { *out = *in @@ -1286,6 +1925,27 @@ func (in *ProjectSpec) DeepCopy() *ProjectSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Question) DeepCopyInto(out *Question) { + *out = *in + if in.Options != nil { + in, out := &in.Options, &out.Options + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Question. +func (in *Question) DeepCopy() *Question { + if in == nil { + return nil + } + out := new(Question) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RKEConfigNode) DeepCopyInto(out *RKEConfigNode) { *out = *in @@ -1349,6 +2009,7 @@ func (in *RancherKubernetesEngineConfig) DeepCopyInto(out *RancherKubernetesEngi (*out)[key] = val } } + in.Authorization.DeepCopyInto(&out.Authorization) return } @@ -1362,6 +2023,79 @@ func (in *RancherKubernetesEngineConfig) DeepCopy() *RancherKubernetesEngineConf return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RoleTemplate) DeepCopyInto(out *RoleTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Rules != nil { + in, out := &in.Rules, &out.Rules + *out = make([]rbac_v1.PolicyRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RoleTemplateNames != nil { + in, out := &in.RoleTemplateNames, &out.RoleTemplateNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleTemplate. +func (in *RoleTemplate) DeepCopy() *RoleTemplate { + if in == nil { + return nil + } + out := new(RoleTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RoleTemplate) 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 *RoleTemplateList) DeepCopyInto(out *RoleTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]RoleTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoleTemplateList. +func (in *RoleTemplateList) DeepCopy() *RoleTemplateList { + if in == nil { + return nil + } + out := new(RoleTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RoleTemplateList) 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 *SchedulerService) DeepCopyInto(out *SchedulerService) { *out = *in @@ -1378,3 +2112,384 @@ func (in *SchedulerService) DeepCopy() *SchedulerService { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Template) DeepCopyInto(out *Template) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Template. +func (in *Template) DeepCopy() *Template { + if in == nil { + return nil + } + out := new(Template) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Template) 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 *TemplateList) DeepCopyInto(out *TemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Template, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateList. +func (in *TemplateList) DeepCopy() *TemplateList { + if in == nil { + return nil + } + out := new(TemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TemplateList) 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 *TemplateSpec) DeepCopyInto(out *TemplateSpec) { + *out = *in + if in.Categories != nil { + in, out := &in.Categories, &out.Categories + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Versions != nil { + in, out := &in.Versions, &out.Versions + *out = make([]TemplateVersionSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateSpec. +func (in *TemplateSpec) DeepCopy() *TemplateSpec { + if in == nil { + return nil + } + out := new(TemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TemplateStatus) DeepCopyInto(out *TemplateStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateStatus. +func (in *TemplateStatus) DeepCopy() *TemplateStatus { + if in == nil { + return nil + } + out := new(TemplateStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TemplateVersion) DeepCopyInto(out *TemplateVersion) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateVersion. +func (in *TemplateVersion) DeepCopy() *TemplateVersion { + if in == nil { + return nil + } + out := new(TemplateVersion) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TemplateVersion) 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 *TemplateVersionList) DeepCopyInto(out *TemplateVersionList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TemplateVersion, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateVersionList. +func (in *TemplateVersionList) DeepCopy() *TemplateVersionList { + if in == nil { + return nil + } + out := new(TemplateVersionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TemplateVersionList) 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 *TemplateVersionSpec) DeepCopyInto(out *TemplateVersionSpec) { + *out = *in + if in.Revision != nil { + in, out := &in.Revision, &out.Revision + if *in == nil { + *out = nil + } else { + *out = new(int) + **out = **in + } + } + if in.Files != nil { + in, out := &in.Files, &out.Files + *out = make([]File, len(*in)) + copy(*out, *in) + } + if in.Questions != nil { + in, out := &in.Questions, &out.Questions + *out = make([]Question, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateVersionSpec. +func (in *TemplateVersionSpec) DeepCopy() *TemplateVersionSpec { + if in == nil { + return nil + } + out := new(TemplateVersionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TemplateVersionStatus) DeepCopyInto(out *TemplateVersionStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateVersionStatus. +func (in *TemplateVersionStatus) DeepCopy() *TemplateVersionStatus { + if in == nil { + return nil + } + out := new(TemplateVersionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Token) DeepCopyInto(out *Token) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.UserIdentity.DeepCopyInto(&out.UserIdentity) + if in.GroupIdentities != nil { + in, out := &in.GroupIdentities, &out.GroupIdentities + *out = make([]Identity, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ProviderInfo != nil { + in, out := &in.ProviderInfo, &out.ProviderInfo + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Token. +func (in *Token) DeepCopy() *Token { + if in == nil { + return nil + } + out := new(Token) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Token) 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 *TokenList) DeepCopyInto(out *TokenList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Token, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TokenList. +func (in *TokenList) DeepCopy() *TokenList { + if in == nil { + return nil + } + out := new(TokenList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TokenList) 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 *User) DeepCopyInto(out *User) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new User. +func (in *User) DeepCopy() *User { + if in == nil { + return nil + } + out := new(User) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *User) 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 *UserList) DeepCopyInto(out *UserList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]User, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserList. +func (in *UserList) DeepCopy() *UserList { + if in == nil { + return nil + } + out := new(UserList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *UserList) 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 *Values) DeepCopyInto(out *Values) { + *out = *in + if in.StringSliceValue != nil { + in, out := &in.StringSliceValue, &out.StringSliceValue + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Values. +func (in *Values) DeepCopy() *Values { + if in == nil { + return nil + } + out := new(Values) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_dynamic_schema_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_dynamic_schema_controller.go new file mode 100644 index 00000000..ea20e5e8 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_dynamic_schema_controller.go @@ -0,0 +1,193 @@ +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 ( + DynamicSchemaGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "DynamicSchema", + } + DynamicSchemaResource = metav1.APIResource{ + Name: "dynamicschemas", + SingularName: "dynamicschema", + Namespaced: false, + Kind: DynamicSchemaGroupVersionKind.Kind, + } +) + +type DynamicSchemaList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DynamicSchema +} + +type DynamicSchemaHandlerFunc func(key string, obj *DynamicSchema) error + +type DynamicSchemaLister interface { + List(namespace string, selector labels.Selector) (ret []*DynamicSchema, err error) + Get(namespace, name string) (*DynamicSchema, error) +} + +type DynamicSchemaController interface { + Informer() cache.SharedIndexInformer + Lister() DynamicSchemaLister + AddHandler(handler DynamicSchemaHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type DynamicSchemaInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*DynamicSchema) (*DynamicSchema, error) + Get(name string, opts metav1.GetOptions) (*DynamicSchema, error) + Update(*DynamicSchema) (*DynamicSchema, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*DynamicSchemaList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() DynamicSchemaController +} + +type dynamicSchemaLister struct { + controller *dynamicSchemaController +} + +func (l *dynamicSchemaLister) List(namespace string, selector labels.Selector) (ret []*DynamicSchema, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*DynamicSchema)) + }) + return +} + +func (l *dynamicSchemaLister) Get(namespace, name string) (*DynamicSchema, 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: DynamicSchemaGroupVersionKind.Group, + Resource: "dynamicSchema", + }, name) + } + return obj.(*DynamicSchema), nil +} + +type dynamicSchemaController struct { + controller.GenericController +} + +func (c *dynamicSchemaController) Lister() DynamicSchemaLister { + return &dynamicSchemaLister{ + controller: c, + } +} + +func (c *dynamicSchemaController) AddHandler(handler DynamicSchemaHandlerFunc) { + c.GenericController.AddHandler(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.(*DynamicSchema)) + }) +} + +type dynamicSchemaFactory struct { +} + +func (c dynamicSchemaFactory) Object() runtime.Object { + return &DynamicSchema{} +} + +func (c dynamicSchemaFactory) List() runtime.Object { + return &DynamicSchemaList{} +} + +func (s *dynamicSchemaClient) Controller() DynamicSchemaController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.dynamicSchemaControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(DynamicSchemaGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &dynamicSchemaController{ + GenericController: genericController, + } + + s.client.dynamicSchemaControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type dynamicSchemaClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller DynamicSchemaController +} + +func (s *dynamicSchemaClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *dynamicSchemaClient) Create(o *DynamicSchema) (*DynamicSchema, error) { + obj, err := s.objectClient.Create(o) + return obj.(*DynamicSchema), err +} + +func (s *dynamicSchemaClient) Get(name string, opts metav1.GetOptions) (*DynamicSchema, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*DynamicSchema), err +} + +func (s *dynamicSchemaClient) Update(o *DynamicSchema) (*DynamicSchema, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*DynamicSchema), err +} + +func (s *dynamicSchemaClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *dynamicSchemaClient) List(opts metav1.ListOptions) (*DynamicSchemaList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*DynamicSchemaList), err +} + +func (s *dynamicSchemaClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *dynamicSchemaClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_dynamic_schema_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_dynamic_schema_lifecycle_adapter.go new file mode 100644 index 00000000..7402695a --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_dynamic_schema_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type DynamicSchemaLifecycle interface { + Create(obj *DynamicSchema) (*DynamicSchema, error) + Remove(obj *DynamicSchema) (*DynamicSchema, error) + Updated(obj *DynamicSchema) (*DynamicSchema, error) +} + +type dynamicSchemaLifecycleAdapter struct { + lifecycle DynamicSchemaLifecycle +} + +func (w *dynamicSchemaLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*DynamicSchema)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *dynamicSchemaLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*DynamicSchema)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *dynamicSchemaLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*DynamicSchema)) + if o == nil { + return nil, err + } + return o, err +} + +func NewDynamicSchemaLifecycleAdapter(name string, client DynamicSchemaInterface, l DynamicSchemaLifecycle) DynamicSchemaHandlerFunc { + adapter := &dynamicSchemaLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *DynamicSchema) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_group_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_group_controller.go new file mode 100644 index 00000000..4b5e8086 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_group_controller.go @@ -0,0 +1,193 @@ +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 ( + GroupGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "Group", + } + GroupResource = metav1.APIResource{ + Name: "groups", + SingularName: "group", + Namespaced: false, + Kind: GroupGroupVersionKind.Kind, + } +) + +type GroupList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Group +} + +type GroupHandlerFunc func(key string, obj *Group) error + +type GroupLister interface { + List(namespace string, selector labels.Selector) (ret []*Group, err error) + Get(namespace, name string) (*Group, error) +} + +type GroupController interface { + Informer() cache.SharedIndexInformer + Lister() GroupLister + AddHandler(handler GroupHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type GroupInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*Group) (*Group, error) + Get(name string, opts metav1.GetOptions) (*Group, error) + Update(*Group) (*Group, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*GroupList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() GroupController +} + +type groupLister struct { + controller *groupController +} + +func (l *groupLister) List(namespace string, selector labels.Selector) (ret []*Group, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*Group)) + }) + return +} + +func (l *groupLister) Get(namespace, name string) (*Group, 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: GroupGroupVersionKind.Group, + Resource: "group", + }, name) + } + return obj.(*Group), nil +} + +type groupController struct { + controller.GenericController +} + +func (c *groupController) Lister() GroupLister { + return &groupLister{ + controller: c, + } +} + +func (c *groupController) AddHandler(handler GroupHandlerFunc) { + c.GenericController.AddHandler(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.(*Group)) + }) +} + +type groupFactory struct { +} + +func (c groupFactory) Object() runtime.Object { + return &Group{} +} + +func (c groupFactory) List() runtime.Object { + return &GroupList{} +} + +func (s *groupClient) Controller() GroupController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.groupControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(GroupGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &groupController{ + GenericController: genericController, + } + + s.client.groupControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type groupClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller GroupController +} + +func (s *groupClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *groupClient) Create(o *Group) (*Group, error) { + obj, err := s.objectClient.Create(o) + return obj.(*Group), err +} + +func (s *groupClient) Get(name string, opts metav1.GetOptions) (*Group, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*Group), err +} + +func (s *groupClient) Update(o *Group) (*Group, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*Group), err +} + +func (s *groupClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *groupClient) List(opts metav1.ListOptions) (*GroupList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*GroupList), err +} + +func (s *groupClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *groupClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_group_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_group_lifecycle_adapter.go new file mode 100644 index 00000000..57433b0a --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_group_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type GroupLifecycle interface { + Create(obj *Group) (*Group, error) + Remove(obj *Group) (*Group, error) + Updated(obj *Group) (*Group, error) +} + +type groupLifecycleAdapter struct { + lifecycle GroupLifecycle +} + +func (w *groupLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*Group)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *groupLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*Group)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *groupLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*Group)) + if o == nil { + return nil, err + } + return o, err +} + +func NewGroupLifecycleAdapter(name string, client GroupInterface, l GroupLifecycle) GroupHandlerFunc { + adapter := &groupLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *Group) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_group_member_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_group_member_controller.go new file mode 100644 index 00000000..14666911 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_group_member_controller.go @@ -0,0 +1,193 @@ +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 ( + GroupMemberGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "GroupMember", + } + GroupMemberResource = metav1.APIResource{ + Name: "groupmembers", + SingularName: "groupmember", + Namespaced: false, + Kind: GroupMemberGroupVersionKind.Kind, + } +) + +type GroupMemberList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []GroupMember +} + +type GroupMemberHandlerFunc func(key string, obj *GroupMember) error + +type GroupMemberLister interface { + List(namespace string, selector labels.Selector) (ret []*GroupMember, err error) + Get(namespace, name string) (*GroupMember, error) +} + +type GroupMemberController interface { + Informer() cache.SharedIndexInformer + Lister() GroupMemberLister + AddHandler(handler GroupMemberHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type GroupMemberInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*GroupMember) (*GroupMember, error) + Get(name string, opts metav1.GetOptions) (*GroupMember, error) + Update(*GroupMember) (*GroupMember, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*GroupMemberList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() GroupMemberController +} + +type groupMemberLister struct { + controller *groupMemberController +} + +func (l *groupMemberLister) List(namespace string, selector labels.Selector) (ret []*GroupMember, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*GroupMember)) + }) + return +} + +func (l *groupMemberLister) Get(namespace, name string) (*GroupMember, 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: GroupMemberGroupVersionKind.Group, + Resource: "groupMember", + }, name) + } + return obj.(*GroupMember), nil +} + +type groupMemberController struct { + controller.GenericController +} + +func (c *groupMemberController) Lister() GroupMemberLister { + return &groupMemberLister{ + controller: c, + } +} + +func (c *groupMemberController) AddHandler(handler GroupMemberHandlerFunc) { + c.GenericController.AddHandler(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.(*GroupMember)) + }) +} + +type groupMemberFactory struct { +} + +func (c groupMemberFactory) Object() runtime.Object { + return &GroupMember{} +} + +func (c groupMemberFactory) List() runtime.Object { + return &GroupMemberList{} +} + +func (s *groupMemberClient) Controller() GroupMemberController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.groupMemberControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(GroupMemberGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &groupMemberController{ + GenericController: genericController, + } + + s.client.groupMemberControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type groupMemberClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller GroupMemberController +} + +func (s *groupMemberClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *groupMemberClient) Create(o *GroupMember) (*GroupMember, error) { + obj, err := s.objectClient.Create(o) + return obj.(*GroupMember), err +} + +func (s *groupMemberClient) Get(name string, opts metav1.GetOptions) (*GroupMember, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*GroupMember), err +} + +func (s *groupMemberClient) Update(o *GroupMember) (*GroupMember, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*GroupMember), err +} + +func (s *groupMemberClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *groupMemberClient) List(opts metav1.ListOptions) (*GroupMemberList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*GroupMemberList), err +} + +func (s *groupMemberClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *groupMemberClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_group_member_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_group_member_lifecycle_adapter.go new file mode 100644 index 00000000..4cf7f7b4 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_group_member_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type GroupMemberLifecycle interface { + Create(obj *GroupMember) (*GroupMember, error) + Remove(obj *GroupMember) (*GroupMember, error) + Updated(obj *GroupMember) (*GroupMember, error) +} + +type groupMemberLifecycleAdapter struct { + lifecycle GroupMemberLifecycle +} + +func (w *groupMemberLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*GroupMember)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *groupMemberLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*GroupMember)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *groupMemberLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*GroupMember)) + if o == nil { + return nil, err + } + return o, err +} + +func NewGroupMemberLifecycleAdapter(name string, client GroupMemberInterface, l GroupMemberLifecycle) GroupMemberHandlerFunc { + adapter := &groupMemberLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *GroupMember) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_identity_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_identity_controller.go new file mode 100644 index 00000000..e87cf68c --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_identity_controller.go @@ -0,0 +1,193 @@ +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 ( + IdentityGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "Identity", + } + IdentityResource = metav1.APIResource{ + Name: "identities", + SingularName: "identity", + Namespaced: false, + Kind: IdentityGroupVersionKind.Kind, + } +) + +type IdentityList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Identity +} + +type IdentityHandlerFunc func(key string, obj *Identity) error + +type IdentityLister interface { + List(namespace string, selector labels.Selector) (ret []*Identity, err error) + Get(namespace, name string) (*Identity, error) +} + +type IdentityController interface { + Informer() cache.SharedIndexInformer + Lister() IdentityLister + AddHandler(handler IdentityHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type IdentityInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*Identity) (*Identity, error) + Get(name string, opts metav1.GetOptions) (*Identity, error) + Update(*Identity) (*Identity, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*IdentityList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() IdentityController +} + +type identityLister struct { + controller *identityController +} + +func (l *identityLister) List(namespace string, selector labels.Selector) (ret []*Identity, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*Identity)) + }) + return +} + +func (l *identityLister) Get(namespace, name string) (*Identity, 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: IdentityGroupVersionKind.Group, + Resource: "identity", + }, name) + } + return obj.(*Identity), nil +} + +type identityController struct { + controller.GenericController +} + +func (c *identityController) Lister() IdentityLister { + return &identityLister{ + controller: c, + } +} + +func (c *identityController) AddHandler(handler IdentityHandlerFunc) { + c.GenericController.AddHandler(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.(*Identity)) + }) +} + +type identityFactory struct { +} + +func (c identityFactory) Object() runtime.Object { + return &Identity{} +} + +func (c identityFactory) List() runtime.Object { + return &IdentityList{} +} + +func (s *identityClient) Controller() IdentityController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.identityControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(IdentityGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &identityController{ + GenericController: genericController, + } + + s.client.identityControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type identityClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller IdentityController +} + +func (s *identityClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *identityClient) Create(o *Identity) (*Identity, error) { + obj, err := s.objectClient.Create(o) + return obj.(*Identity), err +} + +func (s *identityClient) Get(name string, opts metav1.GetOptions) (*Identity, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*Identity), err +} + +func (s *identityClient) Update(o *Identity) (*Identity, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*Identity), err +} + +func (s *identityClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *identityClient) List(opts metav1.ListOptions) (*IdentityList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*IdentityList), err +} + +func (s *identityClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *identityClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_identity_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_identity_lifecycle_adapter.go new file mode 100644 index 00000000..ef119bb0 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_identity_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type IdentityLifecycle interface { + Create(obj *Identity) (*Identity, error) + Remove(obj *Identity) (*Identity, error) + Updated(obj *Identity) (*Identity, error) +} + +type identityLifecycleAdapter struct { + lifecycle IdentityLifecycle +} + +func (w *identityLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*Identity)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *identityLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*Identity)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *identityLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*Identity)) + if o == nil { + return nil, err + } + return o, err +} + +func NewIdentityLifecycleAdapter(name string, client IdentityInterface, l IdentityLifecycle) IdentityHandlerFunc { + adapter := &identityLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *Identity) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_k8s_client.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_k8s_client.go index f9a32144..b7bb0709 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_k8s_client.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_k8s_client.go @@ -18,12 +18,22 @@ type Interface interface { MachineDriversGetter MachineTemplatesGetter ProjectsGetter - ProjectRoleTemplatesGetter + RoleTemplatesGetter PodSecurityPolicyTemplatesGetter - ClusterRoleTemplatesGetter ClusterRoleTemplateBindingsGetter ProjectRoleTemplateBindingsGetter ClustersGetter + ClusterEventsGetter + ClusterRegistrationTokensGetter + CatalogsGetter + TemplatesGetter + TemplateVersionsGetter + IdentitiesGetter + TokensGetter + UsersGetter + GroupsGetter + GroupMembersGetter + DynamicSchemasGetter } type Client struct { @@ -35,12 +45,22 @@ type Client struct { machineDriverControllers map[string]MachineDriverController machineTemplateControllers map[string]MachineTemplateController projectControllers map[string]ProjectController - projectRoleTemplateControllers map[string]ProjectRoleTemplateController + roleTemplateControllers map[string]RoleTemplateController podSecurityPolicyTemplateControllers map[string]PodSecurityPolicyTemplateController - clusterRoleTemplateControllers map[string]ClusterRoleTemplateController clusterRoleTemplateBindingControllers map[string]ClusterRoleTemplateBindingController projectRoleTemplateBindingControllers map[string]ProjectRoleTemplateBindingController clusterControllers map[string]ClusterController + clusterEventControllers map[string]ClusterEventController + clusterRegistrationTokenControllers map[string]ClusterRegistrationTokenController + catalogControllers map[string]CatalogController + templateControllers map[string]TemplateController + templateVersionControllers map[string]TemplateVersionController + identityControllers map[string]IdentityController + tokenControllers map[string]TokenController + userControllers map[string]UserController + groupControllers map[string]GroupController + groupMemberControllers map[string]GroupMemberController + dynamicSchemaControllers map[string]DynamicSchemaController } func NewForConfig(config rest.Config) (Interface, error) { @@ -61,12 +81,22 @@ func NewForConfig(config rest.Config) (Interface, error) { machineDriverControllers: map[string]MachineDriverController{}, machineTemplateControllers: map[string]MachineTemplateController{}, projectControllers: map[string]ProjectController{}, - projectRoleTemplateControllers: map[string]ProjectRoleTemplateController{}, + roleTemplateControllers: map[string]RoleTemplateController{}, podSecurityPolicyTemplateControllers: map[string]PodSecurityPolicyTemplateController{}, - clusterRoleTemplateControllers: map[string]ClusterRoleTemplateController{}, clusterRoleTemplateBindingControllers: map[string]ClusterRoleTemplateBindingController{}, projectRoleTemplateBindingControllers: map[string]ProjectRoleTemplateBindingController{}, clusterControllers: map[string]ClusterController{}, + clusterEventControllers: map[string]ClusterEventController{}, + clusterRegistrationTokenControllers: map[string]ClusterRegistrationTokenController{}, + catalogControllers: map[string]CatalogController{}, + templateControllers: map[string]TemplateController{}, + templateVersionControllers: map[string]TemplateVersionController{}, + identityControllers: map[string]IdentityController{}, + tokenControllers: map[string]TokenController{}, + userControllers: map[string]UserController{}, + groupControllers: map[string]GroupController{}, + groupMemberControllers: map[string]GroupMemberController{}, + dynamicSchemaControllers: map[string]DynamicSchemaController{}, }, nil } @@ -134,13 +164,13 @@ func (c *Client) Projects(namespace string) ProjectInterface { } } -type ProjectRoleTemplatesGetter interface { - ProjectRoleTemplates(namespace string) ProjectRoleTemplateInterface +type RoleTemplatesGetter interface { + RoleTemplates(namespace string) RoleTemplateInterface } -func (c *Client) ProjectRoleTemplates(namespace string) ProjectRoleTemplateInterface { - objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ProjectRoleTemplateResource, ProjectRoleTemplateGroupVersionKind, projectRoleTemplateFactory{}) - return &projectRoleTemplateClient{ +func (c *Client) RoleTemplates(namespace string) RoleTemplateInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &RoleTemplateResource, RoleTemplateGroupVersionKind, roleTemplateFactory{}) + return &roleTemplateClient{ ns: namespace, client: c, objectClient: objectClient, @@ -160,19 +190,6 @@ func (c *Client) PodSecurityPolicyTemplates(namespace string) PodSecurityPolicyT } } -type ClusterRoleTemplatesGetter interface { - ClusterRoleTemplates(namespace string) ClusterRoleTemplateInterface -} - -func (c *Client) ClusterRoleTemplates(namespace string) ClusterRoleTemplateInterface { - objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ClusterRoleTemplateResource, ClusterRoleTemplateGroupVersionKind, clusterRoleTemplateFactory{}) - return &clusterRoleTemplateClient{ - ns: namespace, - client: c, - objectClient: objectClient, - } -} - type ClusterRoleTemplateBindingsGetter interface { ClusterRoleTemplateBindings(namespace string) ClusterRoleTemplateBindingInterface } @@ -211,3 +228,146 @@ func (c *Client) Clusters(namespace string) ClusterInterface { objectClient: objectClient, } } + +type ClusterEventsGetter interface { + ClusterEvents(namespace string) ClusterEventInterface +} + +func (c *Client) ClusterEvents(namespace string) ClusterEventInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ClusterEventResource, ClusterEventGroupVersionKind, clusterEventFactory{}) + return &clusterEventClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type ClusterRegistrationTokensGetter interface { + ClusterRegistrationTokens(namespace string) ClusterRegistrationTokenInterface +} + +func (c *Client) ClusterRegistrationTokens(namespace string) ClusterRegistrationTokenInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &ClusterRegistrationTokenResource, ClusterRegistrationTokenGroupVersionKind, clusterRegistrationTokenFactory{}) + return &clusterRegistrationTokenClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type CatalogsGetter interface { + Catalogs(namespace string) CatalogInterface +} + +func (c *Client) Catalogs(namespace string) CatalogInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &CatalogResource, CatalogGroupVersionKind, catalogFactory{}) + return &catalogClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type TemplatesGetter interface { + Templates(namespace string) TemplateInterface +} + +func (c *Client) Templates(namespace string) TemplateInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &TemplateResource, TemplateGroupVersionKind, templateFactory{}) + return &templateClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type TemplateVersionsGetter interface { + TemplateVersions(namespace string) TemplateVersionInterface +} + +func (c *Client) TemplateVersions(namespace string) TemplateVersionInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &TemplateVersionResource, TemplateVersionGroupVersionKind, templateVersionFactory{}) + return &templateVersionClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type IdentitiesGetter interface { + Identities(namespace string) IdentityInterface +} + +func (c *Client) Identities(namespace string) IdentityInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &IdentityResource, IdentityGroupVersionKind, identityFactory{}) + return &identityClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type TokensGetter interface { + Tokens(namespace string) TokenInterface +} + +func (c *Client) Tokens(namespace string) TokenInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &TokenResource, TokenGroupVersionKind, tokenFactory{}) + return &tokenClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type UsersGetter interface { + Users(namespace string) UserInterface +} + +func (c *Client) Users(namespace string) UserInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &UserResource, UserGroupVersionKind, userFactory{}) + return &userClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type GroupsGetter interface { + Groups(namespace string) GroupInterface +} + +func (c *Client) Groups(namespace string) GroupInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &GroupResource, GroupGroupVersionKind, groupFactory{}) + return &groupClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type GroupMembersGetter interface { + GroupMembers(namespace string) GroupMemberInterface +} + +func (c *Client) GroupMembers(namespace string) GroupMemberInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &GroupMemberResource, GroupMemberGroupVersionKind, groupMemberFactory{}) + return &groupMemberClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} + +type DynamicSchemasGetter interface { + DynamicSchemas(namespace string) DynamicSchemaInterface +} + +func (c *Client) DynamicSchemas(namespace string) DynamicSchemaInterface { + objectClient := clientbase.NewObjectClient(namespace, c.restClient, &DynamicSchemaResource, DynamicSchemaGroupVersionKind, dynamicSchemaFactory{}) + return &dynamicSchemaClient{ + ns: namespace, + client: c, + objectClient: objectClient, + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_controller.go index 2740bc72..4dd9c3e0 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_controller.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_controller.go @@ -74,7 +74,13 @@ func (l *machineLister) List(namespace string, selector labels.Selector) (ret [] } func (l *machineLister) Get(namespace, name string) (*Machine, error) { - obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name) + 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 } diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_driver_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_driver_controller.go index 2b66c24c..05966c9d 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_driver_controller.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_driver_controller.go @@ -74,7 +74,13 @@ func (l *machineDriverLister) List(namespace string, selector labels.Selector) ( } func (l *machineDriverLister) Get(namespace, name string) (*MachineDriver, error) { - obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name) + 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 } diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_driver_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_driver_lifecycle_adapter.go index a60c9b1b..dc16059a 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_driver_lifecycle_adapter.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_driver_lifecycle_adapter.go @@ -6,25 +6,37 @@ import ( ) type MachineDriverLifecycle interface { - Initialize(obj *MachineDriver) error - Remove(obj *MachineDriver) error - Updated(obj *MachineDriver) error + Create(obj *MachineDriver) (*MachineDriver, error) + Remove(obj *MachineDriver) (*MachineDriver, error) + Updated(obj *MachineDriver) (*MachineDriver, error) } type machineDriverLifecycleAdapter struct { lifecycle MachineDriverLifecycle } -func (w *machineDriverLifecycleAdapter) Initialize(obj runtime.Object) error { - return w.lifecycle.Initialize(obj.(*MachineDriver)) +func (w *machineDriverLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*MachineDriver)) + if o == nil { + return nil, err + } + return o, err } -func (w *machineDriverLifecycleAdapter) Finalize(obj runtime.Object) error { - return w.lifecycle.Remove(obj.(*MachineDriver)) +func (w *machineDriverLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*MachineDriver)) + if o == nil { + return nil, err + } + return o, err } -func (w *machineDriverLifecycleAdapter) Updated(obj runtime.Object) error { - return w.lifecycle.Updated(obj.(*MachineDriver)) +func (w *machineDriverLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*MachineDriver)) + if o == nil { + return nil, err + } + return o, err } func NewMachineDriverLifecycleAdapter(name string, client MachineDriverInterface, l MachineDriverLifecycle) MachineDriverHandlerFunc { diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_lifecycle_adapter.go index f6af0b55..5281a8d5 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_lifecycle_adapter.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_lifecycle_adapter.go @@ -6,25 +6,37 @@ import ( ) type MachineLifecycle interface { - Initialize(obj *Machine) error - Remove(obj *Machine) error - Updated(obj *Machine) error + Create(obj *Machine) (*Machine, error) + Remove(obj *Machine) (*Machine, error) + Updated(obj *Machine) (*Machine, error) } type machineLifecycleAdapter struct { lifecycle MachineLifecycle } -func (w *machineLifecycleAdapter) Initialize(obj runtime.Object) error { - return w.lifecycle.Initialize(obj.(*Machine)) +func (w *machineLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*Machine)) + if o == nil { + return nil, err + } + return o, err } -func (w *machineLifecycleAdapter) Finalize(obj runtime.Object) error { - return w.lifecycle.Remove(obj.(*Machine)) +func (w *machineLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*Machine)) + if o == nil { + return nil, err + } + return o, err } -func (w *machineLifecycleAdapter) Updated(obj runtime.Object) error { - return w.lifecycle.Updated(obj.(*Machine)) +func (w *machineLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*Machine)) + if o == nil { + return nil, err + } + return o, err } func NewMachineLifecycleAdapter(name string, client MachineInterface, l MachineLifecycle) MachineHandlerFunc { diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_template_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_template_controller.go index fbce768a..ca5499f2 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_template_controller.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_template_controller.go @@ -74,7 +74,13 @@ func (l *machineTemplateLister) List(namespace string, selector labels.Selector) } func (l *machineTemplateLister) Get(namespace, name string) (*MachineTemplate, error) { - obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name) + 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 } diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_template_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_template_lifecycle_adapter.go index 052e80e5..1f3e546e 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_template_lifecycle_adapter.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_machine_template_lifecycle_adapter.go @@ -6,25 +6,37 @@ import ( ) type MachineTemplateLifecycle interface { - Initialize(obj *MachineTemplate) error - Remove(obj *MachineTemplate) error - Updated(obj *MachineTemplate) error + Create(obj *MachineTemplate) (*MachineTemplate, error) + Remove(obj *MachineTemplate) (*MachineTemplate, error) + Updated(obj *MachineTemplate) (*MachineTemplate, error) } type machineTemplateLifecycleAdapter struct { lifecycle MachineTemplateLifecycle } -func (w *machineTemplateLifecycleAdapter) Initialize(obj runtime.Object) error { - return w.lifecycle.Initialize(obj.(*MachineTemplate)) +func (w *machineTemplateLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*MachineTemplate)) + if o == nil { + return nil, err + } + return o, err } -func (w *machineTemplateLifecycleAdapter) Finalize(obj runtime.Object) error { - return w.lifecycle.Remove(obj.(*MachineTemplate)) +func (w *machineTemplateLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*MachineTemplate)) + if o == nil { + return nil, err + } + return o, err } -func (w *machineTemplateLifecycleAdapter) Updated(obj runtime.Object) error { - return w.lifecycle.Updated(obj.(*MachineTemplate)) +func (w *machineTemplateLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*MachineTemplate)) + if o == nil { + return nil, err + } + return o, err } func NewMachineTemplateLifecycleAdapter(name string, client MachineTemplateInterface, l MachineTemplateLifecycle) MachineTemplateHandlerFunc { diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_pod_security_policy_template_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_pod_security_policy_template_controller.go index f7fd7b10..93e46b41 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_pod_security_policy_template_controller.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_pod_security_policy_template_controller.go @@ -74,7 +74,13 @@ func (l *podSecurityPolicyTemplateLister) List(namespace string, selector labels } func (l *podSecurityPolicyTemplateLister) Get(namespace, name string) (*PodSecurityPolicyTemplate, error) { - obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name) + 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 } diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_pod_security_policy_template_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_pod_security_policy_template_lifecycle_adapter.go index 23aa5aee..dc4ef705 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_pod_security_policy_template_lifecycle_adapter.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_pod_security_policy_template_lifecycle_adapter.go @@ -6,25 +6,37 @@ import ( ) type PodSecurityPolicyTemplateLifecycle interface { - Initialize(obj *PodSecurityPolicyTemplate) error - Remove(obj *PodSecurityPolicyTemplate) error - Updated(obj *PodSecurityPolicyTemplate) error + Create(obj *PodSecurityPolicyTemplate) (*PodSecurityPolicyTemplate, error) + Remove(obj *PodSecurityPolicyTemplate) (*PodSecurityPolicyTemplate, error) + Updated(obj *PodSecurityPolicyTemplate) (*PodSecurityPolicyTemplate, error) } type podSecurityPolicyTemplateLifecycleAdapter struct { lifecycle PodSecurityPolicyTemplateLifecycle } -func (w *podSecurityPolicyTemplateLifecycleAdapter) Initialize(obj runtime.Object) error { - return w.lifecycle.Initialize(obj.(*PodSecurityPolicyTemplate)) +func (w *podSecurityPolicyTemplateLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*PodSecurityPolicyTemplate)) + if o == nil { + return nil, err + } + return o, err } -func (w *podSecurityPolicyTemplateLifecycleAdapter) Finalize(obj runtime.Object) error { - return w.lifecycle.Remove(obj.(*PodSecurityPolicyTemplate)) +func (w *podSecurityPolicyTemplateLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*PodSecurityPolicyTemplate)) + if o == nil { + return nil, err + } + return o, err } -func (w *podSecurityPolicyTemplateLifecycleAdapter) Updated(obj runtime.Object) error { - return w.lifecycle.Updated(obj.(*PodSecurityPolicyTemplate)) +func (w *podSecurityPolicyTemplateLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*PodSecurityPolicyTemplate)) + if o == nil { + return nil, err + } + return o, err } func NewPodSecurityPolicyTemplateLifecycleAdapter(name string, client PodSecurityPolicyTemplateInterface, l PodSecurityPolicyTemplateLifecycle) PodSecurityPolicyTemplateHandlerFunc { diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_controller.go index 1e49f2e9..98ddfeeb 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_controller.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_controller.go @@ -74,7 +74,13 @@ func (l *projectLister) List(namespace string, selector labels.Selector) (ret [] } func (l *projectLister) Get(namespace, name string) (*Project, error) { - obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name) + 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 } diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_lifecycle_adapter.go index 4352c71b..74307214 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_lifecycle_adapter.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_lifecycle_adapter.go @@ -6,25 +6,37 @@ import ( ) type ProjectLifecycle interface { - Initialize(obj *Project) error - Remove(obj *Project) error - Updated(obj *Project) error + Create(obj *Project) (*Project, error) + Remove(obj *Project) (*Project, error) + Updated(obj *Project) (*Project, error) } type projectLifecycleAdapter struct { lifecycle ProjectLifecycle } -func (w *projectLifecycleAdapter) Initialize(obj runtime.Object) error { - return w.lifecycle.Initialize(obj.(*Project)) +func (w *projectLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*Project)) + if o == nil { + return nil, err + } + return o, err } -func (w *projectLifecycleAdapter) Finalize(obj runtime.Object) error { - return w.lifecycle.Remove(obj.(*Project)) +func (w *projectLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*Project)) + if o == nil { + return nil, err + } + return o, err } -func (w *projectLifecycleAdapter) Updated(obj runtime.Object) error { - return w.lifecycle.Updated(obj.(*Project)) +func (w *projectLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*Project)) + if o == nil { + return nil, err + } + return o, err } func NewProjectLifecycleAdapter(name string, client ProjectInterface, l ProjectLifecycle) ProjectHandlerFunc { diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_role_template_binding_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_role_template_binding_controller.go index 80ef8758..77f67a45 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_role_template_binding_controller.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_role_template_binding_controller.go @@ -74,7 +74,13 @@ func (l *projectRoleTemplateBindingLister) List(namespace string, selector label } func (l *projectRoleTemplateBindingLister) Get(namespace, name string) (*ProjectRoleTemplateBinding, error) { - obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name) + 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 } diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_role_template_binding_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_role_template_binding_lifecycle_adapter.go index 136da7e3..92dd5136 100644 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_role_template_binding_lifecycle_adapter.go +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_role_template_binding_lifecycle_adapter.go @@ -6,25 +6,37 @@ import ( ) type ProjectRoleTemplateBindingLifecycle interface { - Initialize(obj *ProjectRoleTemplateBinding) error - Remove(obj *ProjectRoleTemplateBinding) error - Updated(obj *ProjectRoleTemplateBinding) error + Create(obj *ProjectRoleTemplateBinding) (*ProjectRoleTemplateBinding, error) + Remove(obj *ProjectRoleTemplateBinding) (*ProjectRoleTemplateBinding, error) + Updated(obj *ProjectRoleTemplateBinding) (*ProjectRoleTemplateBinding, error) } type projectRoleTemplateBindingLifecycleAdapter struct { lifecycle ProjectRoleTemplateBindingLifecycle } -func (w *projectRoleTemplateBindingLifecycleAdapter) Initialize(obj runtime.Object) error { - return w.lifecycle.Initialize(obj.(*ProjectRoleTemplateBinding)) +func (w *projectRoleTemplateBindingLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*ProjectRoleTemplateBinding)) + if o == nil { + return nil, err + } + return o, err } -func (w *projectRoleTemplateBindingLifecycleAdapter) Finalize(obj runtime.Object) error { - return w.lifecycle.Remove(obj.(*ProjectRoleTemplateBinding)) +func (w *projectRoleTemplateBindingLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*ProjectRoleTemplateBinding)) + if o == nil { + return nil, err + } + return o, err } -func (w *projectRoleTemplateBindingLifecycleAdapter) Updated(obj runtime.Object) error { - return w.lifecycle.Updated(obj.(*ProjectRoleTemplateBinding)) +func (w *projectRoleTemplateBindingLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*ProjectRoleTemplateBinding)) + if o == nil { + return nil, err + } + return o, err } func NewProjectRoleTemplateBindingLifecycleAdapter(name string, client ProjectRoleTemplateBindingInterface, l ProjectRoleTemplateBindingLifecycle) ProjectRoleTemplateBindingHandlerFunc { diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_role_template_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_role_template_controller.go deleted file mode 100644 index 6ba46c0d..00000000 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_role_template_controller.go +++ /dev/null @@ -1,187 +0,0 @@ -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 ( - ProjectRoleTemplateGroupVersionKind = schema.GroupVersionKind{ - Version: "v3", - Group: "management.cattle.io", - Kind: "ProjectRoleTemplate", - } - ProjectRoleTemplateResource = metav1.APIResource{ - Name: "projectroletemplates", - SingularName: "projectroletemplate", - Namespaced: false, - Kind: ProjectRoleTemplateGroupVersionKind.Kind, - } -) - -type ProjectRoleTemplateList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ProjectRoleTemplate -} - -type ProjectRoleTemplateHandlerFunc func(key string, obj *ProjectRoleTemplate) error - -type ProjectRoleTemplateLister interface { - List(namespace string, selector labels.Selector) (ret []*ProjectRoleTemplate, err error) - Get(namespace, name string) (*ProjectRoleTemplate, error) -} - -type ProjectRoleTemplateController interface { - Informer() cache.SharedIndexInformer - Lister() ProjectRoleTemplateLister - AddHandler(handler ProjectRoleTemplateHandlerFunc) - Enqueue(namespace, name string) - Sync(ctx context.Context) error - Start(ctx context.Context, threadiness int) error -} - -type ProjectRoleTemplateInterface interface { - ObjectClient() *clientbase.ObjectClient - Create(*ProjectRoleTemplate) (*ProjectRoleTemplate, error) - Get(name string, opts metav1.GetOptions) (*ProjectRoleTemplate, error) - Update(*ProjectRoleTemplate) (*ProjectRoleTemplate, error) - Delete(name string, options *metav1.DeleteOptions) error - List(opts metav1.ListOptions) (*ProjectRoleTemplateList, error) - Watch(opts metav1.ListOptions) (watch.Interface, error) - DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error - Controller() ProjectRoleTemplateController -} - -type projectRoleTemplateLister struct { - controller *projectRoleTemplateController -} - -func (l *projectRoleTemplateLister) List(namespace string, selector labels.Selector) (ret []*ProjectRoleTemplate, err error) { - err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { - ret = append(ret, obj.(*ProjectRoleTemplate)) - }) - return -} - -func (l *projectRoleTemplateLister) Get(namespace, name string) (*ProjectRoleTemplate, error) { - obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(schema.GroupResource{ - Group: ProjectRoleTemplateGroupVersionKind.Group, - Resource: "projectRoleTemplate", - }, name) - } - return obj.(*ProjectRoleTemplate), nil -} - -type projectRoleTemplateController struct { - controller.GenericController -} - -func (c *projectRoleTemplateController) Lister() ProjectRoleTemplateLister { - return &projectRoleTemplateLister{ - controller: c, - } -} - -func (c *projectRoleTemplateController) AddHandler(handler ProjectRoleTemplateHandlerFunc) { - c.GenericController.AddHandler(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.(*ProjectRoleTemplate)) - }) -} - -type projectRoleTemplateFactory struct { -} - -func (c projectRoleTemplateFactory) Object() runtime.Object { - return &ProjectRoleTemplate{} -} - -func (c projectRoleTemplateFactory) List() runtime.Object { - return &ProjectRoleTemplateList{} -} - -func (s *projectRoleTemplateClient) Controller() ProjectRoleTemplateController { - s.client.Lock() - defer s.client.Unlock() - - c, ok := s.client.projectRoleTemplateControllers[s.ns] - if ok { - return c - } - - genericController := controller.NewGenericController(ProjectRoleTemplateGroupVersionKind.Kind+"Controller", - s.objectClient) - - c = &projectRoleTemplateController{ - GenericController: genericController, - } - - s.client.projectRoleTemplateControllers[s.ns] = c - s.client.starters = append(s.client.starters, c) - - return c -} - -type projectRoleTemplateClient struct { - client *Client - ns string - objectClient *clientbase.ObjectClient - controller ProjectRoleTemplateController -} - -func (s *projectRoleTemplateClient) ObjectClient() *clientbase.ObjectClient { - return s.objectClient -} - -func (s *projectRoleTemplateClient) Create(o *ProjectRoleTemplate) (*ProjectRoleTemplate, error) { - obj, err := s.objectClient.Create(o) - return obj.(*ProjectRoleTemplate), err -} - -func (s *projectRoleTemplateClient) Get(name string, opts metav1.GetOptions) (*ProjectRoleTemplate, error) { - obj, err := s.objectClient.Get(name, opts) - return obj.(*ProjectRoleTemplate), err -} - -func (s *projectRoleTemplateClient) Update(o *ProjectRoleTemplate) (*ProjectRoleTemplate, error) { - obj, err := s.objectClient.Update(o.Name, o) - return obj.(*ProjectRoleTemplate), err -} - -func (s *projectRoleTemplateClient) Delete(name string, options *metav1.DeleteOptions) error { - return s.objectClient.Delete(name, options) -} - -func (s *projectRoleTemplateClient) List(opts metav1.ListOptions) (*ProjectRoleTemplateList, error) { - obj, err := s.objectClient.List(opts) - return obj.(*ProjectRoleTemplateList), err -} - -func (s *projectRoleTemplateClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { - return s.objectClient.Watch(opts) -} - -func (s *projectRoleTemplateClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { - return s.objectClient.DeleteCollection(deleteOpts, listOpts) -} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_role_template_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_role_template_lifecycle_adapter.go deleted file mode 100644 index 44974958..00000000 --- a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_project_role_template_lifecycle_adapter.go +++ /dev/null @@ -1,39 +0,0 @@ -package v3 - -import ( - "github.com/rancher/norman/lifecycle" - "k8s.io/apimachinery/pkg/runtime" -) - -type ProjectRoleTemplateLifecycle interface { - Initialize(obj *ProjectRoleTemplate) error - Remove(obj *ProjectRoleTemplate) error - Updated(obj *ProjectRoleTemplate) error -} - -type projectRoleTemplateLifecycleAdapter struct { - lifecycle ProjectRoleTemplateLifecycle -} - -func (w *projectRoleTemplateLifecycleAdapter) Initialize(obj runtime.Object) error { - return w.lifecycle.Initialize(obj.(*ProjectRoleTemplate)) -} - -func (w *projectRoleTemplateLifecycleAdapter) Finalize(obj runtime.Object) error { - return w.lifecycle.Remove(obj.(*ProjectRoleTemplate)) -} - -func (w *projectRoleTemplateLifecycleAdapter) Updated(obj runtime.Object) error { - return w.lifecycle.Updated(obj.(*ProjectRoleTemplate)) -} - -func NewProjectRoleTemplateLifecycleAdapter(name string, client ProjectRoleTemplateInterface, l ProjectRoleTemplateLifecycle) ProjectRoleTemplateHandlerFunc { - adapter := &projectRoleTemplateLifecycleAdapter{lifecycle: l} - syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) - return func(key string, obj *ProjectRoleTemplate) error { - if obj == nil { - return syncFn(key, nil) - } - return syncFn(key, obj) - } -} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_role_template_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_role_template_controller.go new file mode 100644 index 00000000..c310a75e --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_role_template_controller.go @@ -0,0 +1,193 @@ +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 ( + RoleTemplateGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "RoleTemplate", + } + RoleTemplateResource = metav1.APIResource{ + Name: "roletemplates", + SingularName: "roletemplate", + Namespaced: false, + Kind: RoleTemplateGroupVersionKind.Kind, + } +) + +type RoleTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []RoleTemplate +} + +type RoleTemplateHandlerFunc func(key string, obj *RoleTemplate) error + +type RoleTemplateLister interface { + List(namespace string, selector labels.Selector) (ret []*RoleTemplate, err error) + Get(namespace, name string) (*RoleTemplate, error) +} + +type RoleTemplateController interface { + Informer() cache.SharedIndexInformer + Lister() RoleTemplateLister + AddHandler(handler RoleTemplateHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type RoleTemplateInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*RoleTemplate) (*RoleTemplate, error) + Get(name string, opts metav1.GetOptions) (*RoleTemplate, error) + Update(*RoleTemplate) (*RoleTemplate, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*RoleTemplateList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() RoleTemplateController +} + +type roleTemplateLister struct { + controller *roleTemplateController +} + +func (l *roleTemplateLister) List(namespace string, selector labels.Selector) (ret []*RoleTemplate, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*RoleTemplate)) + }) + return +} + +func (l *roleTemplateLister) Get(namespace, name string) (*RoleTemplate, 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: RoleTemplateGroupVersionKind.Group, + Resource: "roleTemplate", + }, name) + } + return obj.(*RoleTemplate), nil +} + +type roleTemplateController struct { + controller.GenericController +} + +func (c *roleTemplateController) Lister() RoleTemplateLister { + return &roleTemplateLister{ + controller: c, + } +} + +func (c *roleTemplateController) AddHandler(handler RoleTemplateHandlerFunc) { + c.GenericController.AddHandler(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.(*RoleTemplate)) + }) +} + +type roleTemplateFactory struct { +} + +func (c roleTemplateFactory) Object() runtime.Object { + return &RoleTemplate{} +} + +func (c roleTemplateFactory) List() runtime.Object { + return &RoleTemplateList{} +} + +func (s *roleTemplateClient) Controller() RoleTemplateController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.roleTemplateControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(RoleTemplateGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &roleTemplateController{ + GenericController: genericController, + } + + s.client.roleTemplateControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type roleTemplateClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller RoleTemplateController +} + +func (s *roleTemplateClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *roleTemplateClient) Create(o *RoleTemplate) (*RoleTemplate, error) { + obj, err := s.objectClient.Create(o) + return obj.(*RoleTemplate), err +} + +func (s *roleTemplateClient) Get(name string, opts metav1.GetOptions) (*RoleTemplate, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*RoleTemplate), err +} + +func (s *roleTemplateClient) Update(o *RoleTemplate) (*RoleTemplate, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*RoleTemplate), err +} + +func (s *roleTemplateClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *roleTemplateClient) List(opts metav1.ListOptions) (*RoleTemplateList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*RoleTemplateList), err +} + +func (s *roleTemplateClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *roleTemplateClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_role_template_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_role_template_lifecycle_adapter.go new file mode 100644 index 00000000..91d875ef --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_role_template_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type RoleTemplateLifecycle interface { + Create(obj *RoleTemplate) (*RoleTemplate, error) + Remove(obj *RoleTemplate) (*RoleTemplate, error) + Updated(obj *RoleTemplate) (*RoleTemplate, error) +} + +type roleTemplateLifecycleAdapter struct { + lifecycle RoleTemplateLifecycle +} + +func (w *roleTemplateLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*RoleTemplate)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *roleTemplateLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*RoleTemplate)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *roleTemplateLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*RoleTemplate)) + if o == nil { + return nil, err + } + return o, err +} + +func NewRoleTemplateLifecycleAdapter(name string, client RoleTemplateInterface, l RoleTemplateLifecycle) RoleTemplateHandlerFunc { + adapter := &roleTemplateLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *RoleTemplate) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_controller.go new file mode 100644 index 00000000..99f1a4b2 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_controller.go @@ -0,0 +1,193 @@ +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 ( + TemplateGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "Template", + } + TemplateResource = metav1.APIResource{ + Name: "templates", + SingularName: "template", + Namespaced: false, + Kind: TemplateGroupVersionKind.Kind, + } +) + +type TemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Template +} + +type TemplateHandlerFunc func(key string, obj *Template) error + +type TemplateLister interface { + List(namespace string, selector labels.Selector) (ret []*Template, err error) + Get(namespace, name string) (*Template, error) +} + +type TemplateController interface { + Informer() cache.SharedIndexInformer + Lister() TemplateLister + AddHandler(handler TemplateHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type TemplateInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*Template) (*Template, error) + Get(name string, opts metav1.GetOptions) (*Template, error) + Update(*Template) (*Template, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*TemplateList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() TemplateController +} + +type templateLister struct { + controller *templateController +} + +func (l *templateLister) List(namespace string, selector labels.Selector) (ret []*Template, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*Template)) + }) + return +} + +func (l *templateLister) Get(namespace, name string) (*Template, 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: TemplateGroupVersionKind.Group, + Resource: "template", + }, name) + } + return obj.(*Template), nil +} + +type templateController struct { + controller.GenericController +} + +func (c *templateController) Lister() TemplateLister { + return &templateLister{ + controller: c, + } +} + +func (c *templateController) AddHandler(handler TemplateHandlerFunc) { + c.GenericController.AddHandler(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.(*Template)) + }) +} + +type templateFactory struct { +} + +func (c templateFactory) Object() runtime.Object { + return &Template{} +} + +func (c templateFactory) List() runtime.Object { + return &TemplateList{} +} + +func (s *templateClient) Controller() TemplateController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.templateControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(TemplateGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &templateController{ + GenericController: genericController, + } + + s.client.templateControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type templateClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller TemplateController +} + +func (s *templateClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *templateClient) Create(o *Template) (*Template, error) { + obj, err := s.objectClient.Create(o) + return obj.(*Template), err +} + +func (s *templateClient) Get(name string, opts metav1.GetOptions) (*Template, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*Template), err +} + +func (s *templateClient) Update(o *Template) (*Template, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*Template), err +} + +func (s *templateClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *templateClient) List(opts metav1.ListOptions) (*TemplateList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*TemplateList), err +} + +func (s *templateClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *templateClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_lifecycle_adapter.go new file mode 100644 index 00000000..da282e1b --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type TemplateLifecycle interface { + Create(obj *Template) (*Template, error) + Remove(obj *Template) (*Template, error) + Updated(obj *Template) (*Template, error) +} + +type templateLifecycleAdapter struct { + lifecycle TemplateLifecycle +} + +func (w *templateLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*Template)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *templateLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*Template)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *templateLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*Template)) + if o == nil { + return nil, err + } + return o, err +} + +func NewTemplateLifecycleAdapter(name string, client TemplateInterface, l TemplateLifecycle) TemplateHandlerFunc { + adapter := &templateLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *Template) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_version_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_version_controller.go new file mode 100644 index 00000000..7da4f017 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_version_controller.go @@ -0,0 +1,193 @@ +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 ( + TemplateVersionGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "TemplateVersion", + } + TemplateVersionResource = metav1.APIResource{ + Name: "templateversions", + SingularName: "templateversion", + Namespaced: false, + Kind: TemplateVersionGroupVersionKind.Kind, + } +) + +type TemplateVersionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []TemplateVersion +} + +type TemplateVersionHandlerFunc func(key string, obj *TemplateVersion) error + +type TemplateVersionLister interface { + List(namespace string, selector labels.Selector) (ret []*TemplateVersion, err error) + Get(namespace, name string) (*TemplateVersion, error) +} + +type TemplateVersionController interface { + Informer() cache.SharedIndexInformer + Lister() TemplateVersionLister + AddHandler(handler TemplateVersionHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type TemplateVersionInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*TemplateVersion) (*TemplateVersion, error) + Get(name string, opts metav1.GetOptions) (*TemplateVersion, error) + Update(*TemplateVersion) (*TemplateVersion, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*TemplateVersionList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() TemplateVersionController +} + +type templateVersionLister struct { + controller *templateVersionController +} + +func (l *templateVersionLister) List(namespace string, selector labels.Selector) (ret []*TemplateVersion, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*TemplateVersion)) + }) + return +} + +func (l *templateVersionLister) Get(namespace, name string) (*TemplateVersion, 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: TemplateVersionGroupVersionKind.Group, + Resource: "templateVersion", + }, name) + } + return obj.(*TemplateVersion), nil +} + +type templateVersionController struct { + controller.GenericController +} + +func (c *templateVersionController) Lister() TemplateVersionLister { + return &templateVersionLister{ + controller: c, + } +} + +func (c *templateVersionController) AddHandler(handler TemplateVersionHandlerFunc) { + c.GenericController.AddHandler(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.(*TemplateVersion)) + }) +} + +type templateVersionFactory struct { +} + +func (c templateVersionFactory) Object() runtime.Object { + return &TemplateVersion{} +} + +func (c templateVersionFactory) List() runtime.Object { + return &TemplateVersionList{} +} + +func (s *templateVersionClient) Controller() TemplateVersionController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.templateVersionControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(TemplateVersionGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &templateVersionController{ + GenericController: genericController, + } + + s.client.templateVersionControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type templateVersionClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller TemplateVersionController +} + +func (s *templateVersionClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *templateVersionClient) Create(o *TemplateVersion) (*TemplateVersion, error) { + obj, err := s.objectClient.Create(o) + return obj.(*TemplateVersion), err +} + +func (s *templateVersionClient) Get(name string, opts metav1.GetOptions) (*TemplateVersion, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*TemplateVersion), err +} + +func (s *templateVersionClient) Update(o *TemplateVersion) (*TemplateVersion, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*TemplateVersion), err +} + +func (s *templateVersionClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *templateVersionClient) List(opts metav1.ListOptions) (*TemplateVersionList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*TemplateVersionList), err +} + +func (s *templateVersionClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *templateVersionClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_version_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_version_lifecycle_adapter.go new file mode 100644 index 00000000..ed72a928 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_template_version_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type TemplateVersionLifecycle interface { + Create(obj *TemplateVersion) (*TemplateVersion, error) + Remove(obj *TemplateVersion) (*TemplateVersion, error) + Updated(obj *TemplateVersion) (*TemplateVersion, error) +} + +type templateVersionLifecycleAdapter struct { + lifecycle TemplateVersionLifecycle +} + +func (w *templateVersionLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*TemplateVersion)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *templateVersionLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*TemplateVersion)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *templateVersionLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*TemplateVersion)) + if o == nil { + return nil, err + } + return o, err +} + +func NewTemplateVersionLifecycleAdapter(name string, client TemplateVersionInterface, l TemplateVersionLifecycle) TemplateVersionHandlerFunc { + adapter := &templateVersionLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *TemplateVersion) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_token_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_token_controller.go new file mode 100644 index 00000000..dee4a0b1 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_token_controller.go @@ -0,0 +1,193 @@ +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 ( + TokenGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "Token", + } + TokenResource = metav1.APIResource{ + Name: "tokens", + SingularName: "token", + Namespaced: false, + Kind: TokenGroupVersionKind.Kind, + } +) + +type TokenList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Token +} + +type TokenHandlerFunc func(key string, obj *Token) error + +type TokenLister interface { + List(namespace string, selector labels.Selector) (ret []*Token, err error) + Get(namespace, name string) (*Token, error) +} + +type TokenController interface { + Informer() cache.SharedIndexInformer + Lister() TokenLister + AddHandler(handler TokenHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type TokenInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*Token) (*Token, error) + Get(name string, opts metav1.GetOptions) (*Token, error) + Update(*Token) (*Token, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*TokenList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() TokenController +} + +type tokenLister struct { + controller *tokenController +} + +func (l *tokenLister) List(namespace string, selector labels.Selector) (ret []*Token, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*Token)) + }) + return +} + +func (l *tokenLister) Get(namespace, name string) (*Token, 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: TokenGroupVersionKind.Group, + Resource: "token", + }, name) + } + return obj.(*Token), nil +} + +type tokenController struct { + controller.GenericController +} + +func (c *tokenController) Lister() TokenLister { + return &tokenLister{ + controller: c, + } +} + +func (c *tokenController) AddHandler(handler TokenHandlerFunc) { + c.GenericController.AddHandler(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.(*Token)) + }) +} + +type tokenFactory struct { +} + +func (c tokenFactory) Object() runtime.Object { + return &Token{} +} + +func (c tokenFactory) List() runtime.Object { + return &TokenList{} +} + +func (s *tokenClient) Controller() TokenController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.tokenControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(TokenGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &tokenController{ + GenericController: genericController, + } + + s.client.tokenControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type tokenClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller TokenController +} + +func (s *tokenClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *tokenClient) Create(o *Token) (*Token, error) { + obj, err := s.objectClient.Create(o) + return obj.(*Token), err +} + +func (s *tokenClient) Get(name string, opts metav1.GetOptions) (*Token, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*Token), err +} + +func (s *tokenClient) Update(o *Token) (*Token, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*Token), err +} + +func (s *tokenClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *tokenClient) List(opts metav1.ListOptions) (*TokenList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*TokenList), err +} + +func (s *tokenClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *tokenClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_token_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_token_lifecycle_adapter.go new file mode 100644 index 00000000..8106d34c --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_token_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type TokenLifecycle interface { + Create(obj *Token) (*Token, error) + Remove(obj *Token) (*Token, error) + Updated(obj *Token) (*Token, error) +} + +type tokenLifecycleAdapter struct { + lifecycle TokenLifecycle +} + +func (w *tokenLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*Token)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *tokenLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*Token)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *tokenLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*Token)) + if o == nil { + return nil, err + } + return o, err +} + +func NewTokenLifecycleAdapter(name string, client TokenInterface, l TokenLifecycle) TokenHandlerFunc { + adapter := &tokenLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *Token) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_user_controller.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_user_controller.go new file mode 100644 index 00000000..0f5aad03 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_user_controller.go @@ -0,0 +1,193 @@ +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 ( + UserGroupVersionKind = schema.GroupVersionKind{ + Version: "v3", + Group: "management.cattle.io", + Kind: "User", + } + UserResource = metav1.APIResource{ + Name: "users", + SingularName: "user", + Namespaced: false, + Kind: UserGroupVersionKind.Kind, + } +) + +type UserList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []User +} + +type UserHandlerFunc func(key string, obj *User) error + +type UserLister interface { + List(namespace string, selector labels.Selector) (ret []*User, err error) + Get(namespace, name string) (*User, error) +} + +type UserController interface { + Informer() cache.SharedIndexInformer + Lister() UserLister + AddHandler(handler UserHandlerFunc) + Enqueue(namespace, name string) + Sync(ctx context.Context) error + Start(ctx context.Context, threadiness int) error +} + +type UserInterface interface { + ObjectClient() *clientbase.ObjectClient + Create(*User) (*User, error) + Get(name string, opts metav1.GetOptions) (*User, error) + Update(*User) (*User, error) + Delete(name string, options *metav1.DeleteOptions) error + List(opts metav1.ListOptions) (*UserList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error + Controller() UserController +} + +type userLister struct { + controller *userController +} + +func (l *userLister) List(namespace string, selector labels.Selector) (ret []*User, err error) { + err = cache.ListAllByNamespace(l.controller.Informer().GetIndexer(), namespace, selector, func(obj interface{}) { + ret = append(ret, obj.(*User)) + }) + return +} + +func (l *userLister) Get(namespace, name string) (*User, 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: UserGroupVersionKind.Group, + Resource: "user", + }, name) + } + return obj.(*User), nil +} + +type userController struct { + controller.GenericController +} + +func (c *userController) Lister() UserLister { + return &userLister{ + controller: c, + } +} + +func (c *userController) AddHandler(handler UserHandlerFunc) { + c.GenericController.AddHandler(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.(*User)) + }) +} + +type userFactory struct { +} + +func (c userFactory) Object() runtime.Object { + return &User{} +} + +func (c userFactory) List() runtime.Object { + return &UserList{} +} + +func (s *userClient) Controller() UserController { + s.client.Lock() + defer s.client.Unlock() + + c, ok := s.client.userControllers[s.ns] + if ok { + return c + } + + genericController := controller.NewGenericController(UserGroupVersionKind.Kind+"Controller", + s.objectClient) + + c = &userController{ + GenericController: genericController, + } + + s.client.userControllers[s.ns] = c + s.client.starters = append(s.client.starters, c) + + return c +} + +type userClient struct { + client *Client + ns string + objectClient *clientbase.ObjectClient + controller UserController +} + +func (s *userClient) ObjectClient() *clientbase.ObjectClient { + return s.objectClient +} + +func (s *userClient) Create(o *User) (*User, error) { + obj, err := s.objectClient.Create(o) + return obj.(*User), err +} + +func (s *userClient) Get(name string, opts metav1.GetOptions) (*User, error) { + obj, err := s.objectClient.Get(name, opts) + return obj.(*User), err +} + +func (s *userClient) Update(o *User) (*User, error) { + obj, err := s.objectClient.Update(o.Name, o) + return obj.(*User), err +} + +func (s *userClient) Delete(name string, options *metav1.DeleteOptions) error { + return s.objectClient.Delete(name, options) +} + +func (s *userClient) List(opts metav1.ListOptions) (*UserList, error) { + obj, err := s.objectClient.List(opts) + return obj.(*UserList), err +} + +func (s *userClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { + return s.objectClient.Watch(opts) +} + +func (s *userClient) DeleteCollection(deleteOpts *metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return s.objectClient.DeleteCollection(deleteOpts, listOpts) +} diff --git a/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_user_lifecycle_adapter.go b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_user_lifecycle_adapter.go new file mode 100644 index 00000000..d7d412e5 --- /dev/null +++ b/vendor/github.com/rancher/types/apis/management.cattle.io/v3/zz_generated_user_lifecycle_adapter.go @@ -0,0 +1,51 @@ +package v3 + +import ( + "github.com/rancher/norman/lifecycle" + "k8s.io/apimachinery/pkg/runtime" +) + +type UserLifecycle interface { + Create(obj *User) (*User, error) + Remove(obj *User) (*User, error) + Updated(obj *User) (*User, error) +} + +type userLifecycleAdapter struct { + lifecycle UserLifecycle +} + +func (w *userLifecycleAdapter) Create(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Create(obj.(*User)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *userLifecycleAdapter) Finalize(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Remove(obj.(*User)) + if o == nil { + return nil, err + } + return o, err +} + +func (w *userLifecycleAdapter) Updated(obj runtime.Object) (runtime.Object, error) { + o, err := w.lifecycle.Updated(obj.(*User)) + if o == nil { + return nil, err + } + return o, err +} + +func NewUserLifecycleAdapter(name string, client UserInterface, l UserLifecycle) UserHandlerFunc { + adapter := &userLifecycleAdapter{lifecycle: l} + syncFn := lifecycle.NewObjectLifecycleAdapter(name, adapter, client.ObjectClient()) + return func(key string, obj *User) error { + if obj == nil { + return syncFn(key, nil) + } + return syncFn(key, obj) + } +} diff --git a/vendor/github.com/rancher/types/vendor.conf b/vendor/github.com/rancher/types/vendor.conf index fcccbc50..5e5e37fb 100644 --- a/vendor/github.com/rancher/types/vendor.conf +++ b/vendor/github.com/rancher/types/vendor.conf @@ -3,5 +3,5 @@ github.com/rancher/types k8s.io/kubernetes v1.8.3 transitive=true,staging=true bitbucket.org/ww/goautoneg a547fc61f48d567d5b4ec6f8aee5573d8efce11d https://github.com/rancher/goautoneg.git -github.com/rancher/norman 18d3f69aa84ed39326e731ebfa509cf104bf9ad1 transitive=true +github.com/rancher/norman 8c0d4bfe2e63a801e4e21906d6b37a5173dadcbb golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5 diff --git a/vendor/gopkg.in/check.v1/.gitignore b/vendor/gopkg.in/check.v1/.gitignore deleted file mode 100644 index 191a5360..00000000 --- a/vendor/gopkg.in/check.v1/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -_* -*.swp -*.[568] -[568].out diff --git a/vendor/gopkg.in/check.v1/LICENSE b/vendor/gopkg.in/check.v1/LICENSE deleted file mode 100644 index 545cf2d3..00000000 --- a/vendor/gopkg.in/check.v1/LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -Gocheck - A rich testing framework for Go - -Copyright (c) 2010-2013 Gustavo Niemeyer - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/gopkg.in/check.v1/README.md b/vendor/gopkg.in/check.v1/README.md deleted file mode 100644 index 0ca9e572..00000000 --- a/vendor/gopkg.in/check.v1/README.md +++ /dev/null @@ -1,20 +0,0 @@ -Instructions -============ - -Install the package with: - - go get gopkg.in/check.v1 - -Import it with: - - import "gopkg.in/check.v1" - -and use _check_ as the package name inside the code. - -For more details, visit the project page: - -* http://labix.org/gocheck - -and the API documentation: - -* https://gopkg.in/check.v1 diff --git a/vendor/gopkg.in/check.v1/TODO b/vendor/gopkg.in/check.v1/TODO deleted file mode 100644 index 33498270..00000000 --- a/vendor/gopkg.in/check.v1/TODO +++ /dev/null @@ -1,2 +0,0 @@ -- Assert(slice, Contains, item) -- Parallel test support diff --git a/vendor/gopkg.in/check.v1/benchmark.go b/vendor/gopkg.in/check.v1/benchmark.go deleted file mode 100644 index 46ea9dc6..00000000 --- a/vendor/gopkg.in/check.v1/benchmark.go +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) 2012 The Go Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package check - -import ( - "fmt" - "runtime" - "time" -) - -var memStats runtime.MemStats - -// testingB is a type passed to Benchmark functions to manage benchmark -// timing and to specify the number of iterations to run. -type timer struct { - start time.Time // Time test or benchmark started - duration time.Duration - N int - bytes int64 - timerOn bool - benchTime time.Duration - // The initial states of memStats.Mallocs and memStats.TotalAlloc. - startAllocs uint64 - startBytes uint64 - // The net total of this test after being run. - netAllocs uint64 - netBytes uint64 -} - -// StartTimer starts timing a test. This function is called automatically -// before a benchmark starts, but it can also used to resume timing after -// a call to StopTimer. -func (c *C) StartTimer() { - if !c.timerOn { - c.start = time.Now() - c.timerOn = true - - runtime.ReadMemStats(&memStats) - c.startAllocs = memStats.Mallocs - c.startBytes = memStats.TotalAlloc - } -} - -// StopTimer stops timing a test. This can be used to pause the timer -// while performing complex initialization that you don't -// want to measure. -func (c *C) StopTimer() { - if c.timerOn { - c.duration += time.Now().Sub(c.start) - c.timerOn = false - runtime.ReadMemStats(&memStats) - c.netAllocs += memStats.Mallocs - c.startAllocs - c.netBytes += memStats.TotalAlloc - c.startBytes - } -} - -// ResetTimer sets the elapsed benchmark time to zero. -// It does not affect whether the timer is running. -func (c *C) ResetTimer() { - if c.timerOn { - c.start = time.Now() - runtime.ReadMemStats(&memStats) - c.startAllocs = memStats.Mallocs - c.startBytes = memStats.TotalAlloc - } - c.duration = 0 - c.netAllocs = 0 - c.netBytes = 0 -} - -// SetBytes informs the number of bytes that the benchmark processes -// on each iteration. If this is called in a benchmark it will also -// report MB/s. -func (c *C) SetBytes(n int64) { - c.bytes = n -} - -func (c *C) nsPerOp() int64 { - if c.N <= 0 { - return 0 - } - return c.duration.Nanoseconds() / int64(c.N) -} - -func (c *C) mbPerSec() float64 { - if c.bytes <= 0 || c.duration <= 0 || c.N <= 0 { - return 0 - } - return (float64(c.bytes) * float64(c.N) / 1e6) / c.duration.Seconds() -} - -func (c *C) timerString() string { - if c.N <= 0 { - return fmt.Sprintf("%3.3fs", float64(c.duration.Nanoseconds())/1e9) - } - mbs := c.mbPerSec() - mb := "" - if mbs != 0 { - mb = fmt.Sprintf("\t%7.2f MB/s", mbs) - } - nsop := c.nsPerOp() - ns := fmt.Sprintf("%10d ns/op", nsop) - if c.N > 0 && nsop < 100 { - // The format specifiers here make sure that - // the ones digits line up for all three possible formats. - if nsop < 10 { - ns = fmt.Sprintf("%13.2f ns/op", float64(c.duration.Nanoseconds())/float64(c.N)) - } else { - ns = fmt.Sprintf("%12.1f ns/op", float64(c.duration.Nanoseconds())/float64(c.N)) - } - } - memStats := "" - if c.benchMem { - allocedBytes := fmt.Sprintf("%8d B/op", int64(c.netBytes)/int64(c.N)) - allocs := fmt.Sprintf("%8d allocs/op", int64(c.netAllocs)/int64(c.N)) - memStats = fmt.Sprintf("\t%s\t%s", allocedBytes, allocs) - } - return fmt.Sprintf("%8d\t%s%s%s", c.N, ns, mb, memStats) -} - -func min(x, y int) int { - if x > y { - return y - } - return x -} - -func max(x, y int) int { - if x < y { - return y - } - return x -} - -// roundDown10 rounds a number down to the nearest power of 10. -func roundDown10(n int) int { - var tens = 0 - // tens = floor(log_10(n)) - for n > 10 { - n = n / 10 - tens++ - } - // result = 10^tens - result := 1 - for i := 0; i < tens; i++ { - result *= 10 - } - return result -} - -// roundUp rounds x up to a number of the form [1eX, 2eX, 5eX]. -func roundUp(n int) int { - base := roundDown10(n) - if n < (2 * base) { - return 2 * base - } - if n < (5 * base) { - return 5 * base - } - return 10 * base -} diff --git a/vendor/gopkg.in/check.v1/check.go b/vendor/gopkg.in/check.v1/check.go deleted file mode 100644 index c99392a2..00000000 --- a/vendor/gopkg.in/check.v1/check.go +++ /dev/null @@ -1,954 +0,0 @@ -// Package check is a rich testing extension for Go's testing package. -// -// For details about the project, see: -// -// http://labix.org/gocheck -// -package check - -import ( - "bytes" - "errors" - "fmt" - "io" - "math/rand" - "os" - "path" - "path/filepath" - "reflect" - "regexp" - "runtime" - "strconv" - "strings" - "sync" - "sync/atomic" - "time" -) - -// ----------------------------------------------------------------------- -// Internal type which deals with suite method calling. - -const ( - fixtureKd = iota - testKd -) - -type funcKind int - -const ( - succeededSt = iota - failedSt - skippedSt - panickedSt - fixturePanickedSt - missedSt -) - -type funcStatus uint32 - -// A method value can't reach its own Method structure. -type methodType struct { - reflect.Value - Info reflect.Method -} - -func newMethod(receiver reflect.Value, i int) *methodType { - return &methodType{receiver.Method(i), receiver.Type().Method(i)} -} - -func (method *methodType) PC() uintptr { - return method.Info.Func.Pointer() -} - -func (method *methodType) suiteName() string { - t := method.Info.Type.In(0) - if t.Kind() == reflect.Ptr { - t = t.Elem() - } - return t.Name() -} - -func (method *methodType) String() string { - return method.suiteName() + "." + method.Info.Name -} - -func (method *methodType) matches(re *regexp.Regexp) bool { - return (re.MatchString(method.Info.Name) || - re.MatchString(method.suiteName()) || - re.MatchString(method.String())) -} - -type C struct { - method *methodType - kind funcKind - testName string - _status funcStatus - logb *logger - logw io.Writer - done chan *C - reason string - mustFail bool - tempDir *tempDir - benchMem bool - startTime time.Time - timer -} - -func (c *C) status() funcStatus { - return funcStatus(atomic.LoadUint32((*uint32)(&c._status))) -} - -func (c *C) setStatus(s funcStatus) { - atomic.StoreUint32((*uint32)(&c._status), uint32(s)) -} - -func (c *C) stopNow() { - runtime.Goexit() -} - -// logger is a concurrency safe byte.Buffer -type logger struct { - sync.Mutex - writer bytes.Buffer -} - -func (l *logger) Write(buf []byte) (int, error) { - l.Lock() - defer l.Unlock() - return l.writer.Write(buf) -} - -func (l *logger) WriteTo(w io.Writer) (int64, error) { - l.Lock() - defer l.Unlock() - return l.writer.WriteTo(w) -} - -func (l *logger) String() string { - l.Lock() - defer l.Unlock() - return l.writer.String() -} - -// ----------------------------------------------------------------------- -// Handling of temporary files and directories. - -type tempDir struct { - sync.Mutex - path string - counter int -} - -func (td *tempDir) newPath() string { - td.Lock() - defer td.Unlock() - if td.path == "" { - var err error - for i := 0; i != 100; i++ { - path := fmt.Sprintf("%s%ccheck-%d", os.TempDir(), os.PathSeparator, rand.Int()) - if err = os.Mkdir(path, 0700); err == nil { - td.path = path - break - } - } - if td.path == "" { - panic("Couldn't create temporary directory: " + err.Error()) - } - } - result := filepath.Join(td.path, strconv.Itoa(td.counter)) - td.counter += 1 - return result -} - -func (td *tempDir) removeAll() { - td.Lock() - defer td.Unlock() - if td.path != "" { - err := os.RemoveAll(td.path) - if err != nil { - fmt.Fprintf(os.Stderr, "WARNING: Error cleaning up temporaries: "+err.Error()) - } - } -} - -// Create a new temporary directory which is automatically removed after -// the suite finishes running. -func (c *C) MkDir() string { - path := c.tempDir.newPath() - if err := os.Mkdir(path, 0700); err != nil { - panic(fmt.Sprintf("Couldn't create temporary directory %s: %s", path, err.Error())) - } - return path -} - -// ----------------------------------------------------------------------- -// Low-level logging functions. - -func (c *C) log(args ...interface{}) { - c.writeLog([]byte(fmt.Sprint(args...) + "\n")) -} - -func (c *C) logf(format string, args ...interface{}) { - c.writeLog([]byte(fmt.Sprintf(format+"\n", args...))) -} - -func (c *C) logNewLine() { - c.writeLog([]byte{'\n'}) -} - -func (c *C) writeLog(buf []byte) { - c.logb.Write(buf) - if c.logw != nil { - c.logw.Write(buf) - } -} - -func hasStringOrError(x interface{}) (ok bool) { - _, ok = x.(fmt.Stringer) - if ok { - return - } - _, ok = x.(error) - return -} - -func (c *C) logValue(label string, value interface{}) { - if label == "" { - if hasStringOrError(value) { - c.logf("... %#v (%q)", value, value) - } else { - c.logf("... %#v", value) - } - } else if value == nil { - c.logf("... %s = nil", label) - } else { - if hasStringOrError(value) { - fv := fmt.Sprintf("%#v", value) - qv := fmt.Sprintf("%q", value) - if fv != qv { - c.logf("... %s %s = %s (%s)", label, reflect.TypeOf(value), fv, qv) - return - } - } - if s, ok := value.(string); ok && isMultiLine(s) { - c.logf(`... %s %s = "" +`, label, reflect.TypeOf(value)) - c.logMultiLine(s) - } else { - c.logf("... %s %s = %#v", label, reflect.TypeOf(value), value) - } - } -} - -func (c *C) logMultiLine(s string) { - b := make([]byte, 0, len(s)*2) - i := 0 - n := len(s) - for i < n { - j := i + 1 - for j < n && s[j-1] != '\n' { - j++ - } - b = append(b, "... "...) - b = strconv.AppendQuote(b, s[i:j]) - if j < n { - b = append(b, " +"...) - } - b = append(b, '\n') - i = j - } - c.writeLog(b) -} - -func isMultiLine(s string) bool { - for i := 0; i+1 < len(s); i++ { - if s[i] == '\n' { - return true - } - } - return false -} - -func (c *C) logString(issue string) { - c.log("... ", issue) -} - -func (c *C) logCaller(skip int) { - // This is a bit heavier than it ought to be. - skip += 1 // Our own frame. - pc, callerFile, callerLine, ok := runtime.Caller(skip) - if !ok { - return - } - var testFile string - var testLine int - testFunc := runtime.FuncForPC(c.method.PC()) - if runtime.FuncForPC(pc) != testFunc { - for { - skip += 1 - if pc, file, line, ok := runtime.Caller(skip); ok { - // Note that the test line may be different on - // distinct calls for the same test. Showing - // the "internal" line is helpful when debugging. - if runtime.FuncForPC(pc) == testFunc { - testFile, testLine = file, line - break - } - } else { - break - } - } - } - if testFile != "" && (testFile != callerFile || testLine != callerLine) { - c.logCode(testFile, testLine) - } - c.logCode(callerFile, callerLine) -} - -func (c *C) logCode(path string, line int) { - c.logf("%s:%d:", nicePath(path), line) - code, err := printLine(path, line) - if code == "" { - code = "..." // XXX Open the file and take the raw line. - if err != nil { - code += err.Error() - } - } - c.log(indent(code, " ")) -} - -var valueGo = filepath.Join("reflect", "value.go") -var asmGo = filepath.Join("runtime", "asm_") - -func (c *C) logPanic(skip int, value interface{}) { - skip++ // Our own frame. - initialSkip := skip - for ; ; skip++ { - if pc, file, line, ok := runtime.Caller(skip); ok { - if skip == initialSkip { - c.logf("... Panic: %s (PC=0x%X)\n", value, pc) - } - name := niceFuncName(pc) - path := nicePath(file) - if strings.Contains(path, "/gopkg.in/check.v") { - continue - } - if name == "Value.call" && strings.HasSuffix(path, valueGo) { - continue - } - if (name == "call16" || name == "call32") && strings.Contains(path, asmGo) { - continue - } - c.logf("%s:%d\n in %s", nicePath(file), line, name) - } else { - break - } - } -} - -func (c *C) logSoftPanic(issue string) { - c.log("... Panic: ", issue) -} - -func (c *C) logArgPanic(method *methodType, expectedType string) { - c.logf("... Panic: %s argument should be %s", - niceFuncName(method.PC()), expectedType) -} - -// ----------------------------------------------------------------------- -// Some simple formatting helpers. - -var initWD, initWDErr = os.Getwd() - -func init() { - if initWDErr == nil { - initWD = strings.Replace(initWD, "\\", "/", -1) + "/" - } -} - -func nicePath(path string) string { - if initWDErr == nil { - if strings.HasPrefix(path, initWD) { - return path[len(initWD):] - } - } - return path -} - -func niceFuncPath(pc uintptr) string { - function := runtime.FuncForPC(pc) - if function != nil { - filename, line := function.FileLine(pc) - return fmt.Sprintf("%s:%d", nicePath(filename), line) - } - return "" -} - -func niceFuncName(pc uintptr) string { - function := runtime.FuncForPC(pc) - if function != nil { - name := path.Base(function.Name()) - if i := strings.Index(name, "."); i > 0 { - name = name[i+1:] - } - if strings.HasPrefix(name, "(*") { - if i := strings.Index(name, ")"); i > 0 { - name = name[2:i] + name[i+1:] - } - } - if i := strings.LastIndex(name, ".*"); i != -1 { - name = name[:i] + "." + name[i+2:] - } - if i := strings.LastIndex(name, "·"); i != -1 { - name = name[:i] + "." + name[i+2:] - } - return name - } - return "" -} - -// ----------------------------------------------------------------------- -// Result tracker to aggregate call results. - -type Result struct { - Succeeded int - Failed int - Skipped int - Panicked int - FixturePanicked int - ExpectedFailures int - Missed int // Not even tried to run, related to a panic in the fixture. - RunError error // Houston, we've got a problem. - WorkDir string // If KeepWorkDir is true -} - -type resultTracker struct { - result Result - _lastWasProblem bool - _waiting int - _missed int - _expectChan chan *C - _doneChan chan *C - _stopChan chan bool -} - -func newResultTracker() *resultTracker { - return &resultTracker{_expectChan: make(chan *C), // Synchronous - _doneChan: make(chan *C, 32), // Asynchronous - _stopChan: make(chan bool)} // Synchronous -} - -func (tracker *resultTracker) start() { - go tracker._loopRoutine() -} - -func (tracker *resultTracker) waitAndStop() { - <-tracker._stopChan -} - -func (tracker *resultTracker) expectCall(c *C) { - tracker._expectChan <- c -} - -func (tracker *resultTracker) callDone(c *C) { - tracker._doneChan <- c -} - -func (tracker *resultTracker) _loopRoutine() { - for { - var c *C - if tracker._waiting > 0 { - // Calls still running. Can't stop. - select { - // XXX Reindent this (not now to make diff clear) - case c = <-tracker._expectChan: - tracker._waiting += 1 - case c = <-tracker._doneChan: - tracker._waiting -= 1 - switch c.status() { - case succeededSt: - if c.kind == testKd { - if c.mustFail { - tracker.result.ExpectedFailures++ - } else { - tracker.result.Succeeded++ - } - } - case failedSt: - tracker.result.Failed++ - case panickedSt: - if c.kind == fixtureKd { - tracker.result.FixturePanicked++ - } else { - tracker.result.Panicked++ - } - case fixturePanickedSt: - // Track it as missed, since the panic - // was on the fixture, not on the test. - tracker.result.Missed++ - case missedSt: - tracker.result.Missed++ - case skippedSt: - if c.kind == testKd { - tracker.result.Skipped++ - } - } - } - } else { - // No calls. Can stop, but no done calls here. - select { - case tracker._stopChan <- true: - return - case c = <-tracker._expectChan: - tracker._waiting += 1 - case c = <-tracker._doneChan: - panic("Tracker got an unexpected done call.") - } - } - } -} - -// ----------------------------------------------------------------------- -// The underlying suite runner. - -type suiteRunner struct { - suite interface{} - setUpSuite, tearDownSuite *methodType - setUpTest, tearDownTest *methodType - tests []*methodType - tracker *resultTracker - tempDir *tempDir - keepDir bool - output *outputWriter - reportedProblemLast bool - benchTime time.Duration - benchMem bool -} - -type RunConf struct { - Output io.Writer - Stream bool - Verbose bool - Filter string - Benchmark bool - BenchmarkTime time.Duration // Defaults to 1 second - BenchmarkMem bool - KeepWorkDir bool -} - -// Create a new suiteRunner able to run all methods in the given suite. -func newSuiteRunner(suite interface{}, runConf *RunConf) *suiteRunner { - var conf RunConf - if runConf != nil { - conf = *runConf - } - if conf.Output == nil { - conf.Output = os.Stdout - } - if conf.Benchmark { - conf.Verbose = true - } - - suiteType := reflect.TypeOf(suite) - suiteNumMethods := suiteType.NumMethod() - suiteValue := reflect.ValueOf(suite) - - runner := &suiteRunner{ - suite: suite, - output: newOutputWriter(conf.Output, conf.Stream, conf.Verbose), - tracker: newResultTracker(), - benchTime: conf.BenchmarkTime, - benchMem: conf.BenchmarkMem, - tempDir: &tempDir{}, - keepDir: conf.KeepWorkDir, - tests: make([]*methodType, 0, suiteNumMethods), - } - if runner.benchTime == 0 { - runner.benchTime = 1 * time.Second - } - - var filterRegexp *regexp.Regexp - if conf.Filter != "" { - if regexp, err := regexp.Compile(conf.Filter); err != nil { - msg := "Bad filter expression: " + err.Error() - runner.tracker.result.RunError = errors.New(msg) - return runner - } else { - filterRegexp = regexp - } - } - - for i := 0; i != suiteNumMethods; i++ { - method := newMethod(suiteValue, i) - switch method.Info.Name { - case "SetUpSuite": - runner.setUpSuite = method - case "TearDownSuite": - runner.tearDownSuite = method - case "SetUpTest": - runner.setUpTest = method - case "TearDownTest": - runner.tearDownTest = method - default: - prefix := "Test" - if conf.Benchmark { - prefix = "Benchmark" - } - if !strings.HasPrefix(method.Info.Name, prefix) { - continue - } - if filterRegexp == nil || method.matches(filterRegexp) { - runner.tests = append(runner.tests, method) - } - } - } - return runner -} - -// Run all methods in the given suite. -func (runner *suiteRunner) run() *Result { - if runner.tracker.result.RunError == nil && len(runner.tests) > 0 { - runner.tracker.start() - if runner.checkFixtureArgs() { - c := runner.runFixture(runner.setUpSuite, "", nil) - if c == nil || c.status() == succeededSt { - for i := 0; i != len(runner.tests); i++ { - c := runner.runTest(runner.tests[i]) - if c.status() == fixturePanickedSt { - runner.skipTests(missedSt, runner.tests[i+1:]) - break - } - } - } else if c != nil && c.status() == skippedSt { - runner.skipTests(skippedSt, runner.tests) - } else { - runner.skipTests(missedSt, runner.tests) - } - runner.runFixture(runner.tearDownSuite, "", nil) - } else { - runner.skipTests(missedSt, runner.tests) - } - runner.tracker.waitAndStop() - if runner.keepDir { - runner.tracker.result.WorkDir = runner.tempDir.path - } else { - runner.tempDir.removeAll() - } - } - return &runner.tracker.result -} - -// Create a call object with the given suite method, and fork a -// goroutine with the provided dispatcher for running it. -func (runner *suiteRunner) forkCall(method *methodType, kind funcKind, testName string, logb *logger, dispatcher func(c *C)) *C { - var logw io.Writer - if runner.output.Stream { - logw = runner.output - } - if logb == nil { - logb = new(logger) - } - c := &C{ - method: method, - kind: kind, - testName: testName, - logb: logb, - logw: logw, - tempDir: runner.tempDir, - done: make(chan *C, 1), - timer: timer{benchTime: runner.benchTime}, - startTime: time.Now(), - benchMem: runner.benchMem, - } - runner.tracker.expectCall(c) - go (func() { - runner.reportCallStarted(c) - defer runner.callDone(c) - dispatcher(c) - })() - return c -} - -// Same as forkCall(), but wait for call to finish before returning. -func (runner *suiteRunner) runFunc(method *methodType, kind funcKind, testName string, logb *logger, dispatcher func(c *C)) *C { - c := runner.forkCall(method, kind, testName, logb, dispatcher) - <-c.done - return c -} - -// Handle a finished call. If there were any panics, update the call status -// accordingly. Then, mark the call as done and report to the tracker. -func (runner *suiteRunner) callDone(c *C) { - value := recover() - if value != nil { - switch v := value.(type) { - case *fixturePanic: - if v.status == skippedSt { - c.setStatus(skippedSt) - } else { - c.logSoftPanic("Fixture has panicked (see related PANIC)") - c.setStatus(fixturePanickedSt) - } - default: - c.logPanic(1, value) - c.setStatus(panickedSt) - } - } - if c.mustFail { - switch c.status() { - case failedSt: - c.setStatus(succeededSt) - case succeededSt: - c.setStatus(failedSt) - c.logString("Error: Test succeeded, but was expected to fail") - c.logString("Reason: " + c.reason) - } - } - - runner.reportCallDone(c) - c.done <- c -} - -// Runs a fixture call synchronously. The fixture will still be run in a -// goroutine like all suite methods, but this method will not return -// while the fixture goroutine is not done, because the fixture must be -// run in a desired order. -func (runner *suiteRunner) runFixture(method *methodType, testName string, logb *logger) *C { - if method != nil { - c := runner.runFunc(method, fixtureKd, testName, logb, func(c *C) { - c.ResetTimer() - c.StartTimer() - defer c.StopTimer() - c.method.Call([]reflect.Value{reflect.ValueOf(c)}) - }) - return c - } - return nil -} - -// Run the fixture method with runFixture(), but panic with a fixturePanic{} -// in case the fixture method panics. This makes it easier to track the -// fixture panic together with other call panics within forkTest(). -func (runner *suiteRunner) runFixtureWithPanic(method *methodType, testName string, logb *logger, skipped *bool) *C { - if skipped != nil && *skipped { - return nil - } - c := runner.runFixture(method, testName, logb) - if c != nil && c.status() != succeededSt { - if skipped != nil { - *skipped = c.status() == skippedSt - } - panic(&fixturePanic{c.status(), method}) - } - return c -} - -type fixturePanic struct { - status funcStatus - method *methodType -} - -// Run the suite test method, together with the test-specific fixture, -// asynchronously. -func (runner *suiteRunner) forkTest(method *methodType) *C { - testName := method.String() - return runner.forkCall(method, testKd, testName, nil, func(c *C) { - var skipped bool - defer runner.runFixtureWithPanic(runner.tearDownTest, testName, nil, &skipped) - defer c.StopTimer() - benchN := 1 - for { - runner.runFixtureWithPanic(runner.setUpTest, testName, c.logb, &skipped) - mt := c.method.Type() - if mt.NumIn() != 1 || mt.In(0) != reflect.TypeOf(c) { - // Rather than a plain panic, provide a more helpful message when - // the argument type is incorrect. - c.setStatus(panickedSt) - c.logArgPanic(c.method, "*check.C") - return - } - if strings.HasPrefix(c.method.Info.Name, "Test") { - c.ResetTimer() - c.StartTimer() - c.method.Call([]reflect.Value{reflect.ValueOf(c)}) - return - } - if !strings.HasPrefix(c.method.Info.Name, "Benchmark") { - panic("unexpected method prefix: " + c.method.Info.Name) - } - - runtime.GC() - c.N = benchN - c.ResetTimer() - c.StartTimer() - c.method.Call([]reflect.Value{reflect.ValueOf(c)}) - c.StopTimer() - if c.status() != succeededSt || c.duration >= c.benchTime || benchN >= 1e9 { - return - } - perOpN := int(1e9) - if c.nsPerOp() != 0 { - perOpN = int(c.benchTime.Nanoseconds() / c.nsPerOp()) - } - - // Logic taken from the stock testing package: - // - Run more iterations than we think we'll need for a second (1.5x). - // - Don't grow too fast in case we had timing errors previously. - // - Be sure to run at least one more than last time. - benchN = max(min(perOpN+perOpN/2, 100*benchN), benchN+1) - benchN = roundUp(benchN) - - skipped = true // Don't run the deferred one if this panics. - runner.runFixtureWithPanic(runner.tearDownTest, testName, nil, nil) - skipped = false - } - }) -} - -// Same as forkTest(), but wait for the test to finish before returning. -func (runner *suiteRunner) runTest(method *methodType) *C { - c := runner.forkTest(method) - <-c.done - return c -} - -// Helper to mark tests as skipped or missed. A bit heavy for what -// it does, but it enables homogeneous handling of tracking, including -// nice verbose output. -func (runner *suiteRunner) skipTests(status funcStatus, methods []*methodType) { - for _, method := range methods { - runner.runFunc(method, testKd, "", nil, func(c *C) { - c.setStatus(status) - }) - } -} - -// Verify if the fixture arguments are *check.C. In case of errors, -// log the error as a panic in the fixture method call, and return false. -func (runner *suiteRunner) checkFixtureArgs() bool { - succeeded := true - argType := reflect.TypeOf(&C{}) - for _, method := range []*methodType{runner.setUpSuite, runner.tearDownSuite, runner.setUpTest, runner.tearDownTest} { - if method != nil { - mt := method.Type() - if mt.NumIn() != 1 || mt.In(0) != argType { - succeeded = false - runner.runFunc(method, fixtureKd, "", nil, func(c *C) { - c.logArgPanic(method, "*check.C") - c.setStatus(panickedSt) - }) - } - } - } - return succeeded -} - -func (runner *suiteRunner) reportCallStarted(c *C) { - runner.output.WriteCallStarted("START", c) -} - -func (runner *suiteRunner) reportCallDone(c *C) { - runner.tracker.callDone(c) - switch c.status() { - case succeededSt: - if c.mustFail { - runner.output.WriteCallSuccess("FAIL EXPECTED", c) - } else { - runner.output.WriteCallSuccess("PASS", c) - } - case skippedSt: - runner.output.WriteCallSuccess("SKIP", c) - case failedSt: - runner.output.WriteCallProblem("FAIL", c) - case panickedSt: - runner.output.WriteCallProblem("PANIC", c) - case fixturePanickedSt: - // That's a testKd call reporting that its fixture - // has panicked. The fixture call which caused the - // panic itself was tracked above. We'll report to - // aid debugging. - runner.output.WriteCallProblem("PANIC", c) - case missedSt: - runner.output.WriteCallSuccess("MISS", c) - } -} - -// ----------------------------------------------------------------------- -// Output writer manages atomic output writing according to settings. - -type outputWriter struct { - m sync.Mutex - writer io.Writer - wroteCallProblemLast bool - Stream bool - Verbose bool -} - -func newOutputWriter(writer io.Writer, stream, verbose bool) *outputWriter { - return &outputWriter{writer: writer, Stream: stream, Verbose: verbose} -} - -func (ow *outputWriter) Write(content []byte) (n int, err error) { - ow.m.Lock() - n, err = ow.writer.Write(content) - ow.m.Unlock() - return -} - -func (ow *outputWriter) WriteCallStarted(label string, c *C) { - if ow.Stream { - header := renderCallHeader(label, c, "", "\n") - ow.m.Lock() - ow.writer.Write([]byte(header)) - ow.m.Unlock() - } -} - -func (ow *outputWriter) WriteCallProblem(label string, c *C) { - var prefix string - if !ow.Stream { - prefix = "\n-----------------------------------" + - "-----------------------------------\n" - } - header := renderCallHeader(label, c, prefix, "\n\n") - ow.m.Lock() - ow.wroteCallProblemLast = true - ow.writer.Write([]byte(header)) - if !ow.Stream { - c.logb.WriteTo(ow.writer) - } - ow.m.Unlock() -} - -func (ow *outputWriter) WriteCallSuccess(label string, c *C) { - if ow.Stream || (ow.Verbose && c.kind == testKd) { - // TODO Use a buffer here. - var suffix string - if c.reason != "" { - suffix = " (" + c.reason + ")" - } - if c.status() == succeededSt { - suffix += "\t" + c.timerString() - } - suffix += "\n" - if ow.Stream { - suffix += "\n" - } - header := renderCallHeader(label, c, "", suffix) - ow.m.Lock() - // Resist temptation of using line as prefix above due to race. - if !ow.Stream && ow.wroteCallProblemLast { - header = "\n-----------------------------------" + - "-----------------------------------\n" + - header - } - ow.wroteCallProblemLast = false - ow.writer.Write([]byte(header)) - ow.m.Unlock() - } -} - -func renderCallHeader(label string, c *C, prefix, suffix string) string { - pc := c.method.PC() - return fmt.Sprintf("%s%s: %s: %s%s", prefix, label, niceFuncPath(pc), - niceFuncName(pc), suffix) -} diff --git a/vendor/gopkg.in/check.v1/checkers.go b/vendor/gopkg.in/check.v1/checkers.go deleted file mode 100644 index bac33872..00000000 --- a/vendor/gopkg.in/check.v1/checkers.go +++ /dev/null @@ -1,458 +0,0 @@ -package check - -import ( - "fmt" - "reflect" - "regexp" -) - -// ----------------------------------------------------------------------- -// CommentInterface and Commentf helper, to attach extra information to checks. - -type comment struct { - format string - args []interface{} -} - -// Commentf returns an infomational value to use with Assert or Check calls. -// If the checker test fails, the provided arguments will be passed to -// fmt.Sprintf, and will be presented next to the logged failure. -// -// For example: -// -// c.Assert(v, Equals, 42, Commentf("Iteration #%d failed.", i)) -// -// Note that if the comment is constant, a better option is to -// simply use a normal comment right above or next to the line, as -// it will also get printed with any errors: -// -// c.Assert(l, Equals, 8192) // Ensure buffer size is correct (bug #123) -// -func Commentf(format string, args ...interface{}) CommentInterface { - return &comment{format, args} -} - -// CommentInterface must be implemented by types that attach extra -// information to failed checks. See the Commentf function for details. -type CommentInterface interface { - CheckCommentString() string -} - -func (c *comment) CheckCommentString() string { - return fmt.Sprintf(c.format, c.args...) -} - -// ----------------------------------------------------------------------- -// The Checker interface. - -// The Checker interface must be provided by checkers used with -// the Assert and Check verification methods. -type Checker interface { - Info() *CheckerInfo - Check(params []interface{}, names []string) (result bool, error string) -} - -// See the Checker interface. -type CheckerInfo struct { - Name string - Params []string -} - -func (info *CheckerInfo) Info() *CheckerInfo { - return info -} - -// ----------------------------------------------------------------------- -// Not checker logic inverter. - -// The Not checker inverts the logic of the provided checker. The -// resulting checker will succeed where the original one failed, and -// vice-versa. -// -// For example: -// -// c.Assert(a, Not(Equals), b) -// -func Not(checker Checker) Checker { - return ¬Checker{checker} -} - -type notChecker struct { - sub Checker -} - -func (checker *notChecker) Info() *CheckerInfo { - info := *checker.sub.Info() - info.Name = "Not(" + info.Name + ")" - return &info -} - -func (checker *notChecker) Check(params []interface{}, names []string) (result bool, error string) { - result, error = checker.sub.Check(params, names) - result = !result - return -} - -// ----------------------------------------------------------------------- -// IsNil checker. - -type isNilChecker struct { - *CheckerInfo -} - -// The IsNil checker tests whether the obtained value is nil. -// -// For example: -// -// c.Assert(err, IsNil) -// -var IsNil Checker = &isNilChecker{ - &CheckerInfo{Name: "IsNil", Params: []string{"value"}}, -} - -func (checker *isNilChecker) Check(params []interface{}, names []string) (result bool, error string) { - return isNil(params[0]), "" -} - -func isNil(obtained interface{}) (result bool) { - if obtained == nil { - result = true - } else { - switch v := reflect.ValueOf(obtained); v.Kind() { - case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return v.IsNil() - } - } - return -} - -// ----------------------------------------------------------------------- -// NotNil checker. Alias for Not(IsNil), since it's so common. - -type notNilChecker struct { - *CheckerInfo -} - -// The NotNil checker verifies that the obtained value is not nil. -// -// For example: -// -// c.Assert(iface, NotNil) -// -// This is an alias for Not(IsNil), made available since it's a -// fairly common check. -// -var NotNil Checker = ¬NilChecker{ - &CheckerInfo{Name: "NotNil", Params: []string{"value"}}, -} - -func (checker *notNilChecker) Check(params []interface{}, names []string) (result bool, error string) { - return !isNil(params[0]), "" -} - -// ----------------------------------------------------------------------- -// Equals checker. - -type equalsChecker struct { - *CheckerInfo -} - -// The Equals checker verifies that the obtained value is equal to -// the expected value, according to usual Go semantics for ==. -// -// For example: -// -// c.Assert(value, Equals, 42) -// -var Equals Checker = &equalsChecker{ - &CheckerInfo{Name: "Equals", Params: []string{"obtained", "expected"}}, -} - -func (checker *equalsChecker) Check(params []interface{}, names []string) (result bool, error string) { - defer func() { - if v := recover(); v != nil { - result = false - error = fmt.Sprint(v) - } - }() - return params[0] == params[1], "" -} - -// ----------------------------------------------------------------------- -// DeepEquals checker. - -type deepEqualsChecker struct { - *CheckerInfo -} - -// The DeepEquals checker verifies that the obtained value is deep-equal to -// the expected value. The check will work correctly even when facing -// slices, interfaces, and values of different types (which always fail -// the test). -// -// For example: -// -// c.Assert(value, DeepEquals, 42) -// c.Assert(array, DeepEquals, []string{"hi", "there"}) -// -var DeepEquals Checker = &deepEqualsChecker{ - &CheckerInfo{Name: "DeepEquals", Params: []string{"obtained", "expected"}}, -} - -func (checker *deepEqualsChecker) Check(params []interface{}, names []string) (result bool, error string) { - return reflect.DeepEqual(params[0], params[1]), "" -} - -// ----------------------------------------------------------------------- -// HasLen checker. - -type hasLenChecker struct { - *CheckerInfo -} - -// The HasLen checker verifies that the obtained value has the -// provided length. In many cases this is superior to using Equals -// in conjuction with the len function because in case the check -// fails the value itself will be printed, instead of its length, -// providing more details for figuring the problem. -// -// For example: -// -// c.Assert(list, HasLen, 5) -// -var HasLen Checker = &hasLenChecker{ - &CheckerInfo{Name: "HasLen", Params: []string{"obtained", "n"}}, -} - -func (checker *hasLenChecker) Check(params []interface{}, names []string) (result bool, error string) { - n, ok := params[1].(int) - if !ok { - return false, "n must be an int" - } - value := reflect.ValueOf(params[0]) - switch value.Kind() { - case reflect.Map, reflect.Array, reflect.Slice, reflect.Chan, reflect.String: - default: - return false, "obtained value type has no length" - } - return value.Len() == n, "" -} - -// ----------------------------------------------------------------------- -// ErrorMatches checker. - -type errorMatchesChecker struct { - *CheckerInfo -} - -// The ErrorMatches checker verifies that the error value -// is non nil and matches the regular expression provided. -// -// For example: -// -// c.Assert(err, ErrorMatches, "perm.*denied") -// -var ErrorMatches Checker = errorMatchesChecker{ - &CheckerInfo{Name: "ErrorMatches", Params: []string{"value", "regex"}}, -} - -func (checker errorMatchesChecker) Check(params []interface{}, names []string) (result bool, errStr string) { - if params[0] == nil { - return false, "Error value is nil" - } - err, ok := params[0].(error) - if !ok { - return false, "Value is not an error" - } - params[0] = err.Error() - names[0] = "error" - return matches(params[0], params[1]) -} - -// ----------------------------------------------------------------------- -// Matches checker. - -type matchesChecker struct { - *CheckerInfo -} - -// The Matches checker verifies that the string provided as the obtained -// value (or the string resulting from obtained.String()) matches the -// regular expression provided. -// -// For example: -// -// c.Assert(err, Matches, "perm.*denied") -// -var Matches Checker = &matchesChecker{ - &CheckerInfo{Name: "Matches", Params: []string{"value", "regex"}}, -} - -func (checker *matchesChecker) Check(params []interface{}, names []string) (result bool, error string) { - return matches(params[0], params[1]) -} - -func matches(value, regex interface{}) (result bool, error string) { - reStr, ok := regex.(string) - if !ok { - return false, "Regex must be a string" - } - valueStr, valueIsStr := value.(string) - if !valueIsStr { - if valueWithStr, valueHasStr := value.(fmt.Stringer); valueHasStr { - valueStr, valueIsStr = valueWithStr.String(), true - } - } - if valueIsStr { - matches, err := regexp.MatchString("^"+reStr+"$", valueStr) - if err != nil { - return false, "Can't compile regex: " + err.Error() - } - return matches, "" - } - return false, "Obtained value is not a string and has no .String()" -} - -// ----------------------------------------------------------------------- -// Panics checker. - -type panicsChecker struct { - *CheckerInfo -} - -// The Panics checker verifies that calling the provided zero-argument -// function will cause a panic which is deep-equal to the provided value. -// -// For example: -// -// c.Assert(func() { f(1, 2) }, Panics, &SomeErrorType{"BOOM"}). -// -// -var Panics Checker = &panicsChecker{ - &CheckerInfo{Name: "Panics", Params: []string{"function", "expected"}}, -} - -func (checker *panicsChecker) Check(params []interface{}, names []string) (result bool, error string) { - f := reflect.ValueOf(params[0]) - if f.Kind() != reflect.Func || f.Type().NumIn() != 0 { - return false, "Function must take zero arguments" - } - defer func() { - // If the function has not panicked, then don't do the check. - if error != "" { - return - } - params[0] = recover() - names[0] = "panic" - result = reflect.DeepEqual(params[0], params[1]) - }() - f.Call(nil) - return false, "Function has not panicked" -} - -type panicMatchesChecker struct { - *CheckerInfo -} - -// The PanicMatches checker verifies that calling the provided zero-argument -// function will cause a panic with an error value matching -// the regular expression provided. -// -// For example: -// -// c.Assert(func() { f(1, 2) }, PanicMatches, `open.*: no such file or directory`). -// -// -var PanicMatches Checker = &panicMatchesChecker{ - &CheckerInfo{Name: "PanicMatches", Params: []string{"function", "expected"}}, -} - -func (checker *panicMatchesChecker) Check(params []interface{}, names []string) (result bool, errmsg string) { - f := reflect.ValueOf(params[0]) - if f.Kind() != reflect.Func || f.Type().NumIn() != 0 { - return false, "Function must take zero arguments" - } - defer func() { - // If the function has not panicked, then don't do the check. - if errmsg != "" { - return - } - obtained := recover() - names[0] = "panic" - if e, ok := obtained.(error); ok { - params[0] = e.Error() - } else if _, ok := obtained.(string); ok { - params[0] = obtained - } else { - errmsg = "Panic value is not a string or an error" - return - } - result, errmsg = matches(params[0], params[1]) - }() - f.Call(nil) - return false, "Function has not panicked" -} - -// ----------------------------------------------------------------------- -// FitsTypeOf checker. - -type fitsTypeChecker struct { - *CheckerInfo -} - -// The FitsTypeOf checker verifies that the obtained value is -// assignable to a variable with the same type as the provided -// sample value. -// -// For example: -// -// c.Assert(value, FitsTypeOf, int64(0)) -// c.Assert(value, FitsTypeOf, os.Error(nil)) -// -var FitsTypeOf Checker = &fitsTypeChecker{ - &CheckerInfo{Name: "FitsTypeOf", Params: []string{"obtained", "sample"}}, -} - -func (checker *fitsTypeChecker) Check(params []interface{}, names []string) (result bool, error string) { - obtained := reflect.ValueOf(params[0]) - sample := reflect.ValueOf(params[1]) - if !obtained.IsValid() { - return false, "" - } - if !sample.IsValid() { - return false, "Invalid sample value" - } - return obtained.Type().AssignableTo(sample.Type()), "" -} - -// ----------------------------------------------------------------------- -// Implements checker. - -type implementsChecker struct { - *CheckerInfo -} - -// The Implements checker verifies that the obtained value -// implements the interface specified via a pointer to an interface -// variable. -// -// For example: -// -// var e os.Error -// c.Assert(err, Implements, &e) -// -var Implements Checker = &implementsChecker{ - &CheckerInfo{Name: "Implements", Params: []string{"obtained", "ifaceptr"}}, -} - -func (checker *implementsChecker) Check(params []interface{}, names []string) (result bool, error string) { - obtained := reflect.ValueOf(params[0]) - ifaceptr := reflect.ValueOf(params[1]) - if !obtained.IsValid() { - return false, "" - } - if !ifaceptr.IsValid() || ifaceptr.Kind() != reflect.Ptr || ifaceptr.Elem().Kind() != reflect.Interface { - return false, "ifaceptr should be a pointer to an interface variable" - } - return obtained.Type().Implements(ifaceptr.Elem().Type()), "" -} diff --git a/vendor/gopkg.in/check.v1/helpers.go b/vendor/gopkg.in/check.v1/helpers.go deleted file mode 100644 index 58a733b5..00000000 --- a/vendor/gopkg.in/check.v1/helpers.go +++ /dev/null @@ -1,231 +0,0 @@ -package check - -import ( - "fmt" - "strings" - "time" -) - -// TestName returns the current test name in the form "SuiteName.TestName" -func (c *C) TestName() string { - return c.testName -} - -// ----------------------------------------------------------------------- -// Basic succeeding/failing logic. - -// Failed returns whether the currently running test has already failed. -func (c *C) Failed() bool { - return c.status() == failedSt -} - -// Fail marks the currently running test as failed. -// -// Something ought to have been previously logged so the developer can tell -// what went wrong. The higher level helper functions will fail the test -// and do the logging properly. -func (c *C) Fail() { - c.setStatus(failedSt) -} - -// FailNow marks the currently running test as failed and stops running it. -// Something ought to have been previously logged so the developer can tell -// what went wrong. The higher level helper functions will fail the test -// and do the logging properly. -func (c *C) FailNow() { - c.Fail() - c.stopNow() -} - -// Succeed marks the currently running test as succeeded, undoing any -// previous failures. -func (c *C) Succeed() { - c.setStatus(succeededSt) -} - -// SucceedNow marks the currently running test as succeeded, undoing any -// previous failures, and stops running the test. -func (c *C) SucceedNow() { - c.Succeed() - c.stopNow() -} - -// ExpectFailure informs that the running test is knowingly broken for -// the provided reason. If the test does not fail, an error will be reported -// to raise attention to this fact. This method is useful to temporarily -// disable tests which cover well known problems until a better time to -// fix the problem is found, without forgetting about the fact that a -// failure still exists. -func (c *C) ExpectFailure(reason string) { - if reason == "" { - panic("Missing reason why the test is expected to fail") - } - c.mustFail = true - c.reason = reason -} - -// Skip skips the running test for the provided reason. If run from within -// SetUpTest, the individual test being set up will be skipped, and if run -// from within SetUpSuite, the whole suite is skipped. -func (c *C) Skip(reason string) { - if reason == "" { - panic("Missing reason why the test is being skipped") - } - c.reason = reason - c.setStatus(skippedSt) - c.stopNow() -} - -// ----------------------------------------------------------------------- -// Basic logging. - -// GetTestLog returns the current test error output. -func (c *C) GetTestLog() string { - return c.logb.String() -} - -// Log logs some information into the test error output. -// The provided arguments are assembled together into a string with fmt.Sprint. -func (c *C) Log(args ...interface{}) { - c.log(args...) -} - -// Log logs some information into the test error output. -// The provided arguments are assembled together into a string with fmt.Sprintf. -func (c *C) Logf(format string, args ...interface{}) { - c.logf(format, args...) -} - -// Output enables *C to be used as a logger in functions that require only -// the minimum interface of *log.Logger. -func (c *C) Output(calldepth int, s string) error { - d := time.Now().Sub(c.startTime) - msec := d / time.Millisecond - sec := d / time.Second - min := d / time.Minute - - c.Logf("[LOG] %d:%02d.%03d %s", min, sec%60, msec%1000, s) - return nil -} - -// Error logs an error into the test error output and marks the test as failed. -// The provided arguments are assembled together into a string with fmt.Sprint. -func (c *C) Error(args ...interface{}) { - c.logCaller(1) - c.logString(fmt.Sprint("Error: ", fmt.Sprint(args...))) - c.logNewLine() - c.Fail() -} - -// Errorf logs an error into the test error output and marks the test as failed. -// The provided arguments are assembled together into a string with fmt.Sprintf. -func (c *C) Errorf(format string, args ...interface{}) { - c.logCaller(1) - c.logString(fmt.Sprintf("Error: "+format, args...)) - c.logNewLine() - c.Fail() -} - -// Fatal logs an error into the test error output, marks the test as failed, and -// stops the test execution. The provided arguments are assembled together into -// a string with fmt.Sprint. -func (c *C) Fatal(args ...interface{}) { - c.logCaller(1) - c.logString(fmt.Sprint("Error: ", fmt.Sprint(args...))) - c.logNewLine() - c.FailNow() -} - -// Fatlaf logs an error into the test error output, marks the test as failed, and -// stops the test execution. The provided arguments are assembled together into -// a string with fmt.Sprintf. -func (c *C) Fatalf(format string, args ...interface{}) { - c.logCaller(1) - c.logString(fmt.Sprint("Error: ", fmt.Sprintf(format, args...))) - c.logNewLine() - c.FailNow() -} - -// ----------------------------------------------------------------------- -// Generic checks and assertions based on checkers. - -// Check verifies if the first value matches the expected value according -// to the provided checker. If they do not match, an error is logged, the -// test is marked as failed, and the test execution continues. -// -// Some checkers may not need the expected argument (e.g. IsNil). -// -// Extra arguments provided to the function are logged next to the reported -// problem when the matching fails. -func (c *C) Check(obtained interface{}, checker Checker, args ...interface{}) bool { - return c.internalCheck("Check", obtained, checker, args...) -} - -// Assert ensures that the first value matches the expected value according -// to the provided checker. If they do not match, an error is logged, the -// test is marked as failed, and the test execution stops. -// -// Some checkers may not need the expected argument (e.g. IsNil). -// -// Extra arguments provided to the function are logged next to the reported -// problem when the matching fails. -func (c *C) Assert(obtained interface{}, checker Checker, args ...interface{}) { - if !c.internalCheck("Assert", obtained, checker, args...) { - c.stopNow() - } -} - -func (c *C) internalCheck(funcName string, obtained interface{}, checker Checker, args ...interface{}) bool { - if checker == nil { - c.logCaller(2) - c.logString(fmt.Sprintf("%s(obtained, nil!?, ...):", funcName)) - c.logString("Oops.. you've provided a nil checker!") - c.logNewLine() - c.Fail() - return false - } - - // If the last argument is a bug info, extract it out. - var comment CommentInterface - if len(args) > 0 { - if c, ok := args[len(args)-1].(CommentInterface); ok { - comment = c - args = args[:len(args)-1] - } - } - - params := append([]interface{}{obtained}, args...) - info := checker.Info() - - if len(params) != len(info.Params) { - names := append([]string{info.Params[0], info.Name}, info.Params[1:]...) - c.logCaller(2) - c.logString(fmt.Sprintf("%s(%s):", funcName, strings.Join(names, ", "))) - c.logString(fmt.Sprintf("Wrong number of parameters for %s: want %d, got %d", info.Name, len(names), len(params)+1)) - c.logNewLine() - c.Fail() - return false - } - - // Copy since it may be mutated by Check. - names := append([]string{}, info.Params...) - - // Do the actual check. - result, error := checker.Check(params, names) - if !result || error != "" { - c.logCaller(2) - for i := 0; i != len(params); i++ { - c.logValue(names[i], params[i]) - } - if comment != nil { - c.logString(comment.CheckCommentString()) - } - if error != "" { - c.logString(error) - } - c.logNewLine() - c.Fail() - return false - } - return true -} diff --git a/vendor/gopkg.in/check.v1/printer.go b/vendor/gopkg.in/check.v1/printer.go deleted file mode 100644 index e0f7557b..00000000 --- a/vendor/gopkg.in/check.v1/printer.go +++ /dev/null @@ -1,168 +0,0 @@ -package check - -import ( - "bytes" - "go/ast" - "go/parser" - "go/printer" - "go/token" - "os" -) - -func indent(s, with string) (r string) { - eol := true - for i := 0; i != len(s); i++ { - c := s[i] - switch { - case eol && c == '\n' || c == '\r': - case c == '\n' || c == '\r': - eol = true - case eol: - eol = false - s = s[:i] + with + s[i:] - i += len(with) - } - } - return s -} - -func printLine(filename string, line int) (string, error) { - fset := token.NewFileSet() - file, err := os.Open(filename) - if err != nil { - return "", err - } - fnode, err := parser.ParseFile(fset, filename, file, parser.ParseComments) - if err != nil { - return "", err - } - config := &printer.Config{Mode: printer.UseSpaces, Tabwidth: 4} - lp := &linePrinter{fset: fset, fnode: fnode, line: line, config: config} - ast.Walk(lp, fnode) - result := lp.output.Bytes() - // Comments leave \n at the end. - n := len(result) - for n > 0 && result[n-1] == '\n' { - n-- - } - return string(result[:n]), nil -} - -type linePrinter struct { - config *printer.Config - fset *token.FileSet - fnode *ast.File - line int - output bytes.Buffer - stmt ast.Stmt -} - -func (lp *linePrinter) emit() bool { - if lp.stmt != nil { - lp.trim(lp.stmt) - lp.printWithComments(lp.stmt) - lp.stmt = nil - return true - } - return false -} - -func (lp *linePrinter) printWithComments(n ast.Node) { - nfirst := lp.fset.Position(n.Pos()).Line - nlast := lp.fset.Position(n.End()).Line - for _, g := range lp.fnode.Comments { - cfirst := lp.fset.Position(g.Pos()).Line - clast := lp.fset.Position(g.End()).Line - if clast == nfirst-1 && lp.fset.Position(n.Pos()).Column == lp.fset.Position(g.Pos()).Column { - for _, c := range g.List { - lp.output.WriteString(c.Text) - lp.output.WriteByte('\n') - } - } - if cfirst >= nfirst && cfirst <= nlast && n.End() <= g.List[0].Slash { - // The printer will not include the comment if it starts past - // the node itself. Trick it into printing by overlapping the - // slash with the end of the statement. - g.List[0].Slash = n.End() - 1 - } - } - node := &printer.CommentedNode{n, lp.fnode.Comments} - lp.config.Fprint(&lp.output, lp.fset, node) -} - -func (lp *linePrinter) Visit(n ast.Node) (w ast.Visitor) { - if n == nil { - if lp.output.Len() == 0 { - lp.emit() - } - return nil - } - first := lp.fset.Position(n.Pos()).Line - last := lp.fset.Position(n.End()).Line - if first <= lp.line && last >= lp.line { - // Print the innermost statement containing the line. - if stmt, ok := n.(ast.Stmt); ok { - if _, ok := n.(*ast.BlockStmt); !ok { - lp.stmt = stmt - } - } - if first == lp.line && lp.emit() { - return nil - } - return lp - } - return nil -} - -func (lp *linePrinter) trim(n ast.Node) bool { - stmt, ok := n.(ast.Stmt) - if !ok { - return true - } - line := lp.fset.Position(n.Pos()).Line - if line != lp.line { - return false - } - switch stmt := stmt.(type) { - case *ast.IfStmt: - stmt.Body = lp.trimBlock(stmt.Body) - case *ast.SwitchStmt: - stmt.Body = lp.trimBlock(stmt.Body) - case *ast.TypeSwitchStmt: - stmt.Body = lp.trimBlock(stmt.Body) - case *ast.CaseClause: - stmt.Body = lp.trimList(stmt.Body) - case *ast.CommClause: - stmt.Body = lp.trimList(stmt.Body) - case *ast.BlockStmt: - stmt.List = lp.trimList(stmt.List) - } - return true -} - -func (lp *linePrinter) trimBlock(stmt *ast.BlockStmt) *ast.BlockStmt { - if !lp.trim(stmt) { - return lp.emptyBlock(stmt) - } - stmt.Rbrace = stmt.Lbrace - return stmt -} - -func (lp *linePrinter) trimList(stmts []ast.Stmt) []ast.Stmt { - for i := 0; i != len(stmts); i++ { - if !lp.trim(stmts[i]) { - stmts[i] = lp.emptyStmt(stmts[i]) - break - } - } - return stmts -} - -func (lp *linePrinter) emptyStmt(n ast.Node) *ast.ExprStmt { - return &ast.ExprStmt{&ast.Ellipsis{n.Pos(), nil}} -} - -func (lp *linePrinter) emptyBlock(n ast.Node) *ast.BlockStmt { - p := n.Pos() - return &ast.BlockStmt{p, []ast.Stmt{lp.emptyStmt(n)}, p} -} diff --git a/vendor/gopkg.in/check.v1/run.go b/vendor/gopkg.in/check.v1/run.go deleted file mode 100644 index da8fd798..00000000 --- a/vendor/gopkg.in/check.v1/run.go +++ /dev/null @@ -1,175 +0,0 @@ -package check - -import ( - "bufio" - "flag" - "fmt" - "os" - "testing" - "time" -) - -// ----------------------------------------------------------------------- -// Test suite registry. - -var allSuites []interface{} - -// Suite registers the given value as a test suite to be run. Any methods -// starting with the Test prefix in the given value will be considered as -// a test method. -func Suite(suite interface{}) interface{} { - allSuites = append(allSuites, suite) - return suite -} - -// ----------------------------------------------------------------------- -// Public running interface. - -var ( - oldFilterFlag = flag.String("gocheck.f", "", "Regular expression selecting which tests and/or suites to run") - oldVerboseFlag = flag.Bool("gocheck.v", false, "Verbose mode") - oldStreamFlag = flag.Bool("gocheck.vv", false, "Super verbose mode (disables output caching)") - oldBenchFlag = flag.Bool("gocheck.b", false, "Run benchmarks") - oldBenchTime = flag.Duration("gocheck.btime", 1*time.Second, "approximate run time for each benchmark") - oldListFlag = flag.Bool("gocheck.list", false, "List the names of all tests that will be run") - oldWorkFlag = flag.Bool("gocheck.work", false, "Display and do not remove the test working directory") - - newFilterFlag = flag.String("check.f", "", "Regular expression selecting which tests and/or suites to run") - newVerboseFlag = flag.Bool("check.v", false, "Verbose mode") - newStreamFlag = flag.Bool("check.vv", false, "Super verbose mode (disables output caching)") - newBenchFlag = flag.Bool("check.b", false, "Run benchmarks") - newBenchTime = flag.Duration("check.btime", 1*time.Second, "approximate run time for each benchmark") - newBenchMem = flag.Bool("check.bmem", false, "Report memory benchmarks") - newListFlag = flag.Bool("check.list", false, "List the names of all tests that will be run") - newWorkFlag = flag.Bool("check.work", false, "Display and do not remove the test working directory") -) - -// TestingT runs all test suites registered with the Suite function, -// printing results to stdout, and reporting any failures back to -// the "testing" package. -func TestingT(testingT *testing.T) { - benchTime := *newBenchTime - if benchTime == 1*time.Second { - benchTime = *oldBenchTime - } - conf := &RunConf{ - Filter: *oldFilterFlag + *newFilterFlag, - Verbose: *oldVerboseFlag || *newVerboseFlag, - Stream: *oldStreamFlag || *newStreamFlag, - Benchmark: *oldBenchFlag || *newBenchFlag, - BenchmarkTime: benchTime, - BenchmarkMem: *newBenchMem, - KeepWorkDir: *oldWorkFlag || *newWorkFlag, - } - if *oldListFlag || *newListFlag { - w := bufio.NewWriter(os.Stdout) - for _, name := range ListAll(conf) { - fmt.Fprintln(w, name) - } - w.Flush() - return - } - result := RunAll(conf) - println(result.String()) - if !result.Passed() { - testingT.Fail() - } -} - -// RunAll runs all test suites registered with the Suite function, using the -// provided run configuration. -func RunAll(runConf *RunConf) *Result { - result := Result{} - for _, suite := range allSuites { - result.Add(Run(suite, runConf)) - } - return &result -} - -// Run runs the provided test suite using the provided run configuration. -func Run(suite interface{}, runConf *RunConf) *Result { - runner := newSuiteRunner(suite, runConf) - return runner.run() -} - -// ListAll returns the names of all the test functions registered with the -// Suite function that will be run with the provided run configuration. -func ListAll(runConf *RunConf) []string { - var names []string - for _, suite := range allSuites { - names = append(names, List(suite, runConf)...) - } - return names -} - -// List returns the names of the test functions in the given -// suite that will be run with the provided run configuration. -func List(suite interface{}, runConf *RunConf) []string { - var names []string - runner := newSuiteRunner(suite, runConf) - for _, t := range runner.tests { - names = append(names, t.String()) - } - return names -} - -// ----------------------------------------------------------------------- -// Result methods. - -func (r *Result) Add(other *Result) { - r.Succeeded += other.Succeeded - r.Skipped += other.Skipped - r.Failed += other.Failed - r.Panicked += other.Panicked - r.FixturePanicked += other.FixturePanicked - r.ExpectedFailures += other.ExpectedFailures - r.Missed += other.Missed - if r.WorkDir != "" && other.WorkDir != "" { - r.WorkDir += ":" + other.WorkDir - } else if other.WorkDir != "" { - r.WorkDir = other.WorkDir - } -} - -func (r *Result) Passed() bool { - return (r.Failed == 0 && r.Panicked == 0 && - r.FixturePanicked == 0 && r.Missed == 0 && - r.RunError == nil) -} - -func (r *Result) String() string { - if r.RunError != nil { - return "ERROR: " + r.RunError.Error() - } - - var value string - if r.Failed == 0 && r.Panicked == 0 && r.FixturePanicked == 0 && - r.Missed == 0 { - value = "OK: " - } else { - value = "OOPS: " - } - value += fmt.Sprintf("%d passed", r.Succeeded) - if r.Skipped != 0 { - value += fmt.Sprintf(", %d skipped", r.Skipped) - } - if r.ExpectedFailures != 0 { - value += fmt.Sprintf(", %d expected failures", r.ExpectedFailures) - } - if r.Failed != 0 { - value += fmt.Sprintf(", %d FAILED", r.Failed) - } - if r.Panicked != 0 { - value += fmt.Sprintf(", %d PANICKED", r.Panicked) - } - if r.FixturePanicked != 0 { - value += fmt.Sprintf(", %d FIXTURE-PANICKED", r.FixturePanicked) - } - if r.Missed != 0 { - value += fmt.Sprintf(", %d MISSED", r.Missed) - } - if r.WorkDir != "" { - value += "\nWORK=" + r.WorkDir - } - return value -}