Commit 0a4d4b43 authored by Clayton Coleman's avatar Clayton Coleman

Move IsAnAPIObject() declarations to register.go

* Add Namespace, UID, Annotations to internal/v1beta1/v1beta2 * Update v1beta3 with minor consistency tweaks
parent 0212c9b2
......@@ -253,6 +253,12 @@ type TypeMeta struct {
ResourceVersion uint64 `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
Namespace string `json:"namespace",omitempty" yaml:"namespace,omitempty"`
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
// Annotations are unstructured key value data stored with a resource that may be set by
// external tooling. They are not queryable and should be preserved when modifying
// objects.
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
}
const (
......@@ -665,6 +671,7 @@ func (*ServerOpList) IsAnAPIObject() {}
// ObjectReference contains enough information to let you inspect or modify the referred object.
type ObjectReference struct {
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
......
......@@ -26,22 +26,40 @@ var Codec = runtime.CodecFor(api.Scheme, "v1beta1")
func init() {
api.Scheme.AddKnownTypes("v1beta1",
&PodList{},
&Pod{},
&ReplicationControllerList{},
&PodList{},
&ReplicationController{},
&ServiceList{},
&ReplicationControllerList{},
&Service{},
&MinionList{},
&Minion{},
&Status{},
&ServerOpList{},
&ServerOp{},
&ContainerManifestList{},
&ServiceList{},
&Endpoints{},
&EndpointsList{},
&Minion{},
&MinionList{},
&Binding{},
&Status{},
&ServerOp{},
&ServerOpList{},
&Event{},
&EventList{},
&ContainerManifestList{},
)
}
func (*Pod) IsAnAPIObject() {}
func (*PodList) IsAnAPIObject() {}
func (*ReplicationController) IsAnAPIObject() {}
func (*ReplicationControllerList) IsAnAPIObject() {}
func (*Service) IsAnAPIObject() {}
func (*ServiceList) IsAnAPIObject() {}
func (*Endpoints) IsAnAPIObject() {}
func (*EndpointsList) IsAnAPIObject() {}
func (*Minion) IsAnAPIObject() {}
func (*MinionList) IsAnAPIObject() {}
func (*Binding) IsAnAPIObject() {}
func (*Status) IsAnAPIObject() {}
func (*ServerOp) IsAnAPIObject() {}
func (*ServerOpList) IsAnAPIObject() {}
func (*Event) IsAnAPIObject() {}
func (*EventList) IsAnAPIObject() {}
func (*ContainerManifestList) IsAnAPIObject() {}
......@@ -69,8 +69,6 @@ type ContainerManifestList struct {
Items []ContainerManifest `json:"items,omitempty" yaml:"items,omitempty"`
}
func (*ContainerManifestList) IsAnAPIObject() {}
// Volume represents a named volume in a pod that may be accessed by any containers in the pod.
type Volume struct {
// Required: This must be a DNS_LABEL. Each volume in a pod must have
......@@ -259,14 +257,18 @@ type Lifecycle struct {
type TypeMeta struct {
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
ID string `json:"id,omitempty" yaml:"id,omitempty"`
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
CreationTimestamp util.Time `json:"creationTimestamp,omitempty" yaml:"creationTimestamp,omitempty"`
SelfLink string `json:"selfLink,omitempty" yaml:"selfLink,omitempty"`
ResourceVersion uint64 `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
Namespace string `json:"namespace",omitempty" yaml:"namespace,omitempty"`
}
func (*TypeMeta) IsAnAPIObject() {}
// Annotations are unstructured key value data stored with a resource that may be set by
// external tooling. They are not queryable and should be preserved when modifying
// objects.
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
}
// PodStatus represents a status of a pod.
type PodStatus string
......@@ -363,8 +365,6 @@ type PodList struct {
Items []Pod `json:"items" yaml:"items,omitempty"`
}
func (*PodList) IsAnAPIObject() {}
// Pod is a collection of containers, used as either input (create, update) or as output (list, get).
type Pod struct {
TypeMeta `json:",inline" yaml:",inline"`
......@@ -373,8 +373,6 @@ type Pod struct {
CurrentState PodState `json:"currentState,omitempty" yaml:"currentState,omitempty"`
}
func (*Pod) IsAnAPIObject() {}
// ReplicationControllerState is the state of a replication controller, either input (create, update) or as output (list, get).
type ReplicationControllerState struct {
Replicas int `json:"replicas" yaml:"replicas"`
......@@ -388,8 +386,6 @@ type ReplicationControllerList struct {
Items []ReplicationController `json:"items,omitempty" yaml:"items,omitempty"`
}
func (*ReplicationControllerList) IsAnAPIObject() {}
// ReplicationController represents the configuration of a replication controller.
type ReplicationController struct {
TypeMeta `json:",inline" yaml:",inline"`
......@@ -398,8 +394,6 @@ type ReplicationController struct {
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
}
func (*ReplicationController) IsAnAPIObject() {}
// PodTemplate holds the information used for creating pods.
type PodTemplate struct {
DesiredState PodState `json:"desiredState,omitempty" yaml:"desiredState,omitempty"`
......@@ -412,8 +406,6 @@ type ServiceList struct {
Items []Service `json:"items" yaml:"items"`
}
func (*ServiceList) IsAnAPIObject() {}
// Service is a named abstraction of software service (for example, mysql) consisting of local port
// (for example 3306) that the proxy listens on, and the selector that determines which pods
// will answer requests sent through the proxy.
......@@ -437,8 +429,6 @@ type Service struct {
ContainerPort util.IntOrString `json:"containerPort,omitempty" yaml:"containerPort,omitempty"`
}
func (*Service) IsAnAPIObject() {}
// Endpoints is a collection of endpoints that implement the actual service, for example:
// Name: "mysql", Endpoints: ["10.10.1.1:1909", "10.10.2.2:8834"]
type Endpoints struct {
......@@ -446,16 +436,12 @@ type Endpoints struct {
Endpoints []string `json:"endpoints,omitempty" yaml:"endpoints,omitempty"`
}
func (*Endpoints) IsAnAPIObject() {}
// EndpointsList is a list of endpoints.
type EndpointsList struct {
TypeMeta `json:",inline" yaml:",inline"`
Items []Endpoints `json:"items,omitempty" yaml:"items,omitempty"`
}
func (*EndpointsList) IsAnAPIObject() {}
// NodeResources represents resources on a Kubernetes system node
// see https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/resources.md for more details.
type NodeResources struct {
......@@ -477,8 +463,6 @@ type Minion struct {
NodeResources NodeResources `json:"resources,omitempty" yaml:"resources,omitempty"`
}
func (*Minion) IsAnAPIObject() {}
// MinionList is a list of minions.
type MinionList struct {
TypeMeta `json:",inline" yaml:",inline"`
......@@ -488,8 +472,6 @@ type MinionList struct {
Items []Minion `json:"items,omitempty" yaml:"items,omitempty"`
}
func (*MinionList) IsAnAPIObject() {}
// Binding is written by a scheduler to cause a pod to be bound to a host.
type Binding struct {
TypeMeta `json:",inline" yaml:",inline"`
......@@ -497,8 +479,6 @@ type Binding struct {
Host string `json:"host" yaml:"host"`
}
func (*Binding) IsAnAPIObject() {}
// Status is a return value for calls that don't return other objects.
// TODO: this could go in apiserver, but I'm including it here so clients needn't
// import both.
......@@ -522,8 +502,6 @@ type Status struct {
Code int `json:"code,omitempty" yaml:"code,omitempty"`
}
func (*Status) IsAnAPIObject() {}
// StatusDetails is a set of additional properties that MAY be set by the
// server to provide additional information about a response. The Reason
// field of a Status object defines what attributes will be set. Clients
......@@ -647,19 +625,16 @@ type ServerOp struct {
TypeMeta `yaml:",inline" json:",inline"`
}
func (*ServerOp) IsAnAPIObject() {}
// ServerOpList is a list of operations, as delivered to API clients.
type ServerOpList struct {
TypeMeta `yaml:",inline" json:",inline"`
Items []ServerOp `yaml:"items,omitempty" json:"items,omitempty"`
}
func (*ServerOpList) IsAnAPIObject() {}
// ObjectReference contains enough information to let you inspect or modify the referred object.
type ObjectReference struct {
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
......@@ -707,12 +682,8 @@ type Event struct {
Source string `json:"source,omitempty" yaml:"source,omitempty"`
}
func (*Event) IsAnAPIObject() {}
// EventList is a list of events.
type EventList struct {
TypeMeta `yaml:",inline" json:",inline"`
Items []Event `yaml:"items,omitempty" json:"items,omitempty"`
}
func (*EventList) IsAnAPIObject() {}
......@@ -26,22 +26,40 @@ var Codec = runtime.CodecFor(api.Scheme, "v1beta2")
func init() {
api.Scheme.AddKnownTypes("v1beta2",
&PodList{},
&Pod{},
&ReplicationControllerList{},
&PodList{},
&ReplicationController{},
&ServiceList{},
&ReplicationControllerList{},
&Service{},
&MinionList{},
&Minion{},
&Status{},
&ServerOpList{},
&ServerOp{},
&ContainerManifestList{},
&ServiceList{},
&Endpoints{},
&EndpointsList{},
&Minion{},
&MinionList{},
&Binding{},
&Status{},
&ServerOp{},
&ServerOpList{},
&Event{},
&EventList{},
&ContainerManifestList{},
)
}
func (*Pod) IsAnAPIObject() {}
func (*PodList) IsAnAPIObject() {}
func (*ReplicationController) IsAnAPIObject() {}
func (*ReplicationControllerList) IsAnAPIObject() {}
func (*Service) IsAnAPIObject() {}
func (*ServiceList) IsAnAPIObject() {}
func (*Endpoints) IsAnAPIObject() {}
func (*EndpointsList) IsAnAPIObject() {}
func (*Minion) IsAnAPIObject() {}
func (*MinionList) IsAnAPIObject() {}
func (*Binding) IsAnAPIObject() {}
func (*Status) IsAnAPIObject() {}
func (*ServerOp) IsAnAPIObject() {}
func (*ServerOpList) IsAnAPIObject() {}
func (*Event) IsAnAPIObject() {}
func (*EventList) IsAnAPIObject() {}
func (*ContainerManifestList) IsAnAPIObject() {}
......@@ -69,8 +69,6 @@ type ContainerManifestList struct {
Items []ContainerManifest `json:"items,omitempty" yaml:"items,omitempty"`
}
func (*ContainerManifestList) IsAnAPIObject() {}
// Volume represents a named volume in a pod that may be accessed by any containers in the pod.
type Volume struct {
// Required: This must be a DNS_LABEL. Each volume in a pod must have
......@@ -257,11 +255,17 @@ type Lifecycle struct {
type TypeMeta struct {
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
ID string `json:"id,omitempty" yaml:"id,omitempty"`
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
CreationTimestamp util.Time `json:"creationTimestamp,omitempty" yaml:"creationTimestamp,omitempty"`
SelfLink string `json:"selfLink,omitempty" yaml:"selfLink,omitempty"`
ResourceVersion uint64 `json:"resourceVersion,omitempty" yaml:"resourceVersion,omitempty"`
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
Namespace string `json:"namespace",omitempty" yaml:"namespace,omitempty"`
// Annotations are unstructured key value data stored with a resource that may be set by
// external tooling. They are not queryable and should be preserved when modifying
// objects.
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
}
// PodStatus represents a status of a pod.
......@@ -359,8 +363,6 @@ type PodList struct {
Items []Pod `json:"items" yaml:"items,omitempty"`
}
func (*PodList) IsAnAPIObject() {}
// Pod is a collection of containers, used as either input (create, update) or as output (list, get).
type Pod struct {
TypeMeta `json:",inline" yaml:",inline"`
......@@ -369,8 +371,6 @@ type Pod struct {
CurrentState PodState `json:"currentState,omitempty" yaml:"currentState,omitempty"`
}
func (*Pod) IsAnAPIObject() {}
// ReplicationControllerState is the state of a replication controller, either input (create, update) or as output (list, get).
type ReplicationControllerState struct {
Replicas int `json:"replicas" yaml:"replicas"`
......@@ -384,8 +384,6 @@ type ReplicationControllerList struct {
Items []ReplicationController `json:"items,omitempty" yaml:"items,omitempty"`
}
func (*ReplicationControllerList) IsAnAPIObject() {}
// ReplicationController represents the configuration of a replication controller.
type ReplicationController struct {
TypeMeta `json:",inline" yaml:",inline"`
......@@ -394,8 +392,6 @@ type ReplicationController struct {
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
}
func (*ReplicationController) IsAnAPIObject() {}
// PodTemplate holds the information used for creating pods.
type PodTemplate struct {
DesiredState PodState `json:"desiredState,omitempty" yaml:"desiredState,omitempty"`
......@@ -408,8 +404,6 @@ type ServiceList struct {
Items []Service `json:"items" yaml:"items"`
}
func (*ServiceList) IsAnAPIObject() {}
// Service is a named abstraction of software service (for example, mysql) consisting of local port
// (for example 3306) that the proxy listens on, and the selector that determines which pods
// will answer requests sent through the proxy.
......@@ -433,8 +427,6 @@ type Service struct {
ContainerPort util.IntOrString `json:"containerPort,omitempty" yaml:"containerPort,omitempty"`
}
func (*Service) IsAnAPIObject() {}
// Endpoints is a collection of endpoints that implement the actual service, for example:
// Name: "mysql", Endpoints: ["10.10.1.1:1909", "10.10.2.2:8834"]
type Endpoints struct {
......@@ -442,16 +434,12 @@ type Endpoints struct {
Endpoints []string `json:"endpoints,omitempty" yaml:"endpoints,omitempty"`
}
func (*Endpoints) IsAnAPIObject() {}
// EndpointsList is a list of endpoints.
type EndpointsList struct {
TypeMeta `json:",inline" yaml:",inline"`
Items []Endpoints `json:"items,omitempty" yaml:"items,omitempty"`
}
func (*EndpointsList) IsAnAPIObject() {}
// NodeResources represents resources on a Kubernetes system node
// see https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/resources.md for more details.
type NodeResources struct {
......@@ -473,8 +461,6 @@ type Minion struct {
NodeResources NodeResources `json:"resources,omitempty" yaml:"resources,omitempty"`
}
func (*Minion) IsAnAPIObject() {}
// MinionList is a list of minions.
type MinionList struct {
TypeMeta `json:",inline" yaml:",inline"`
......@@ -484,8 +470,6 @@ type MinionList struct {
Items []Minion `json:"items,omitempty" yaml:"items,omitempty"`
}
func (*MinionList) IsAnAPIObject() {}
// Binding is written by a scheduler to cause a pod to be bound to a host.
type Binding struct {
TypeMeta `json:",inline" yaml:",inline"`
......@@ -493,8 +477,6 @@ type Binding struct {
Host string `json:"host" yaml:"host"`
}
func (*Binding) IsAnAPIObject() {}
// Status is a return value for calls that don't return other objects.
// TODO: this could go in apiserver, but I'm including it here so clients needn't
// import both.
......@@ -518,8 +500,6 @@ type Status struct {
Code int `json:"code,omitempty" yaml:"code,omitempty"`
}
func (*Status) IsAnAPIObject() {}
// StatusDetails is a set of additional properties that MAY be set by the
// server to provide additional information about a response. The Reason
// field of a Status object defines what attributes will be set. Clients
......@@ -656,19 +636,16 @@ type ServerOp struct {
TypeMeta `yaml:",inline" json:",inline"`
}
func (*ServerOp) IsAnAPIObject() {}
// ServerOpList is a list of operations, as delivered to API clients.
type ServerOpList struct {
TypeMeta `yaml:",inline" json:",inline"`
Items []ServerOp `yaml:"items,omitempty" json:"items,omitempty"`
}
func (*ServerOpList) IsAnAPIObject() {}
// ObjectReference contains enough information to let you inspect or modify the referred object.
type ObjectReference struct {
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
UID string `json:"uid,omitempty" yaml:"uid,omitempty"`
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
......@@ -716,12 +693,8 @@ type Event struct {
Source string `json:"source,omitempty" yaml:"source,omitempty"`
}
func (*Event) IsAnAPIObject() {}
// EventList is a list of events.
type EventList struct {
TypeMeta `yaml:",inline" json:",inline"`
Items []Event `yaml:"items,omitempty" json:"items,omitempty"`
}
func (*EventList) IsAnAPIObject() {}
/*
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package v1beta3 is the v1beta3 version of the API.
package v1beta3
/*
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta3
import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
)
// Codec encodes internal objects to the v1beta3 scheme
var Codec = runtime.CodecFor(api.Scheme, "v1beta3")
func init() {
api.Scheme.AddKnownTypes("v1beta3",
&Pod{},
&PodList{},
&PodTemplate{},
&PodTemplateList{},
&BoundPod{},
&BoundPods{},
&ReplicationController{},
&ReplicationControllerList{},
&Service{},
&ServiceList{},
&Endpoints{},
&EndpointsList{},
&Node{},
&NodeList{},
&Binding{},
&Status{},
&Operation{},
&OperationList{},
&Event{},
&EventList{},
&ContainerManifestList{},
)
}
func (*Pod) IsAnAPIObject() {}
func (*PodList) IsAnAPIObject() {}
func (*PodTemplate) IsAnAPIObject() {}
func (*PodTemplateList) IsAnAPIObject() {}
func (*BoundPod) IsAnAPIObject() {}
func (*BoundPods) IsAnAPIObject() {}
func (*ReplicationController) IsAnAPIObject() {}
func (*ReplicationControllerList) IsAnAPIObject() {}
func (*Service) IsAnAPIObject() {}
func (*ServiceList) IsAnAPIObject() {}
func (*Endpoints) IsAnAPIObject() {}
func (*EndpointsList) IsAnAPIObject() {}
func (*Node) IsAnAPIObject() {}
func (*NodeList) IsAnAPIObject() {}
func (*Binding) IsAnAPIObject() {}
func (*Status) IsAnAPIObject() {}
func (*Operation) IsAnAPIObject() {}
func (*OperationList) IsAnAPIObject() {}
func (*Event) IsAnAPIObject() {}
func (*EventList) IsAnAPIObject() {}
func (*ContainerManifestList) IsAnAPIObject() {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment