From cbabeef8193b72a712ed668b6a867b9c49ee7234 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Tue, 13 Feb 2018 16:46:50 -0700 Subject: [PATCH] Cleanup references --- apis/management.cattle.io/v3/alerting_types.go | 2 +- apis/management.cattle.io/v3/authn_types.go | 12 ++++++------ apis/management.cattle.io/v3/machine_types.go | 2 -- apis/project.cattle.io/v3/schema/schema.go | 2 +- apis/project.cattle.io/v3/schema/types.go | 2 +- apis/project.cattle.io/v3/stack_types.go | 2 +- apis/project.cattle.io/v3/types.go | 2 +- mapper/creator.go | 2 +- mapper/namespace.go | 2 +- 9 files changed, 13 insertions(+), 15 deletions(-) diff --git a/apis/management.cattle.io/v3/alerting_types.go b/apis/management.cattle.io/v3/alerting_types.go index 851cde9c..d7810658 100644 --- a/apis/management.cattle.io/v3/alerting_types.go +++ b/apis/management.cattle.io/v3/alerting_types.go @@ -74,7 +74,7 @@ type TargetNode struct { } type TargetPod struct { - PodName string `json:"podName,omitempty" norman:"required,type=reference[pod]"` + PodName string `json:"podName,omitempty" norman:"required,type=reference[/v3/projects/schemas/pod]"` Condition string `json:"condition,omitempty" norman:"required,options=notrunning|notscheduled|restarts,default=notrunning"` RestartTimes int `json:"restartTimes,omitempty" norman:"min=1"` RestartIntervalSeconds int `json:"restartIntervalSeconds,omitempty" norman:"min=1"` diff --git a/apis/management.cattle.io/v3/authn_types.go b/apis/management.cattle.io/v3/authn_types.go index 48a7bb64..fae9765f 100644 --- a/apis/management.cattle.io/v3/authn_types.go +++ b/apis/management.cattle.io/v3/authn_types.go @@ -9,10 +9,10 @@ type Token struct { metav1.ObjectMeta `json:"metadata,omitempty"` Token string `json:"token" norman:"writeOnly,noupdate"` - UserPrincipal Principal `json:"userPrincipal" norman:"type=reference[Principal]"` - GroupPrincipals []Principal `json:"groupPrincipals" norman:"type=array[reference[Principal]]"` + UserPrincipal Principal `json:"userPrincipal" norman:"type=reference[principal]"` + GroupPrincipals []Principal `json:"groupPrincipals" norman:"type=array[reference[principal]]"` ProviderInfo map[string]string `json:"providerInfo,omitempty"` - UserID string `json:"userId" norman:"type=reference[User]"` + UserID string `json:"userId" norman:"type=reference[user]"` AuthProvider string `json:"authProvider"` TTLMillis int `json:"ttl"` LastUpdateTime string `json:"lastUpdateTime"` @@ -29,7 +29,7 @@ type User struct { Username string `json:"username,omitempty"` Password string `json:"password,omitempty" norman:"writeOnly,noupdate"` MustChangePassword bool `json:"mustChangePassword,omitempty"` - PrincipalIDs []string `json:"principalIds,omitempty" norman:"type=array[reference[Principal]]"` + PrincipalIDs []string `json:"principalIds,omitempty" norman:"type=array[reference[principal]]"` Me bool `json:"me,omitempty"` } @@ -45,7 +45,7 @@ type GroupMember struct { metav1.ObjectMeta `json:"metadata,omitempty"` GroupName string `json:"groupName,omitempty" norman:"type=reference[group]"` - PrincipalID string `json:"principalId,omitempty" norman:"type=reference[Principal]"` + PrincipalID string `json:"principalId,omitempty" norman:"type=reference[principal]"` } type Principal struct { @@ -85,7 +85,7 @@ type AuthConfig struct { Type string `json:"type"` Enabled bool `json:"enabled,omitempty"` AccessMode string `json:"accessMode,omitempty" norman:"required,notnullable,type=enum,options=required|restricted|unrestricted"` - AllowedPrincipalIDs []string `json:"allowedPrincipalIds,omitempty" norman:"type=array[reference[Principal]]"` + AllowedPrincipalIDs []string `json:"allowedPrincipalIds,omitempty" norman:"type=array[reference[principal]]"` } //GithubConfig structure contains the github config definition diff --git a/apis/management.cattle.io/v3/machine_types.go b/apis/management.cattle.io/v3/machine_types.go index 75952003..b301d8aa 100644 --- a/apis/management.cattle.io/v3/machine_types.go +++ b/apis/management.cattle.io/v3/machine_types.go @@ -115,8 +115,6 @@ type CustomConfig struct { DockerSocket string `yaml:"docker_socket" json:"dockerSocket,omitempty"` // SSH Private Key SSHKey string `yaml:"ssh_key" json:"sshKey,omitempty"` - // Roles - Roles []string `yaml:"roles" json:"roles,omitempty"` } type CommonNodeSpec struct { diff --git a/apis/project.cattle.io/v3/schema/schema.go b/apis/project.cattle.io/v3/schema/schema.go index a72171ab..f9195ba9 100644 --- a/apis/project.cattle.io/v3/schema/schema.go +++ b/apis/project.cattle.io/v3/schema/schema.go @@ -439,7 +439,7 @@ func podTypes(schemas *types.Schemas) *types.Schemas { }{}). MustImport(&Version, v1.PodSpec{}, struct { Scheduling *Scheduling - NodeName string `norman:"type=reference[node]"` + NodeName string `norman:"type=reference[/v3/schemas/node]"` }{}). MustImport(&Version, v1.Pod{}, projectOverride{}, struct { Description string `json:"description"` diff --git a/apis/project.cattle.io/v3/schema/types.go b/apis/project.cattle.io/v3/schema/types.go index f034e195..20b65b0b 100644 --- a/apis/project.cattle.io/v3/schema/types.go +++ b/apis/project.cattle.io/v3/schema/types.go @@ -66,7 +66,7 @@ type Scheduling struct { } type NodeScheduling struct { - NodeName string `json:"nodeName" norman:"type=reference[node]"` + NodeName string `json:"nodeName" norman:"type=reference[/v3/schemas/node]"` RequireAll []string RequireAny []string Preferred []string diff --git a/apis/project.cattle.io/v3/stack_types.go b/apis/project.cattle.io/v3/stack_types.go index 0d9ef8db..f95b3e4d 100644 --- a/apis/project.cattle.io/v3/stack_types.go +++ b/apis/project.cattle.io/v3/stack_types.go @@ -15,7 +15,7 @@ type App struct { } type AppSpec struct { - ProjectName string `json:"projectName,omitempty" norman:"type=reference[project]"` + ProjectName string `json:"projectName,omitempty" norman:"type=reference[/v3/schemas/project]"` Description string `json:"description,omitempty"` InstallNamespace string `json:"installNamespace,omitempty"` ExternalID string `json:"externalId,omitempty"` diff --git a/apis/project.cattle.io/v3/types.go b/apis/project.cattle.io/v3/types.go index 71fc17b6..54ef54fa 100644 --- a/apis/project.cattle.io/v3/types.go +++ b/apis/project.cattle.io/v3/types.go @@ -85,7 +85,7 @@ type SSHAuth struct { type NamespacedSSHAuth SSHAuth type PublicEndpoint struct { - NodeName string `json:"nodeName,omitempty" norman:"type=reference[node],nocreate,noupdate"` + NodeName string `json:"nodeName,omitempty" norman:"type=reference[/v3/schemas/node],nocreate,noupdate"` Address string `json:"address,omitempty" norman:"nocreate,noupdate"` Port int32 `json:"port,omitempty" norman:"nocreate,noupdate"` Protocol string `json:"protocol,omitempty" norman:"nocreate,noupdate"` diff --git a/mapper/creator.go b/mapper/creator.go index 3e052e84..3fae7345 100644 --- a/mapper/creator.go +++ b/mapper/creator.go @@ -24,7 +24,7 @@ func (c *Creator) ToInternal(data map[string]interface{}) { func (c *Creator) ModifySchema(schema *types.Schema, schemas *types.Schemas) error { if schema.CanList(nil) && schema.CanCreate(nil) { schema.ResourceFields["creatorId"] = types.Field{ - Type: "reference[user]", + Type: "reference[/v3/schemas/user]", CodeName: "CreatorID", } c.m = &mapper.AnnotationField{Field: "creatorId"} diff --git a/mapper/namespace.go b/mapper/namespace.go index 4394ab9e..3b73039e 100644 --- a/mapper/namespace.go +++ b/mapper/namespace.go @@ -27,7 +27,7 @@ func (n *NamespaceIDMapper) ModifySchema(schema *types.Schema, schemas *types.Sc return nil } - field.Type = "reference[namespace]" + field.Type = "reference[/v3/clusters/schemas/namespace]" field.Required = true field.Update = false schema.ResourceFields["namespace"] = field