backendapi.js 3.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
// Copyright 2015 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.

/**
 * @fileoverview Externs for backend API and model objects. This should be kept in sync with the
 * backend code.
 *
 * Guidelines:
 *  - Model JSONs should have the same name as backend structs.
 *
 * @externs
 */

const backendApi = {};

27 28 29 30 31 32 33 34 35
/**
 * @typedef {{
 *   port: (number|null),
 *   protocol: string,
 *   targetPort: (number|null)
 * }}
 */
backendApi.PortMapping;

36 37
/**
 * @typedef {{
38
 *   containerImage: string,
39 40
 *   containerCommand: ?string,
 *   containerCommandArgs: ?string,
41 42
 *   isExternal: boolean,
 *   name: string,
43
 *   description: ?string,
44
 *   portMappings: !Array<!backendApi.PortMapping>,
45
 *   replicas: number,
46 47
 *   namespace: string,
 *   labels: !Array<!backendApi.Label>
48 49
 * }}
 */
50
backendApi.AppDeploymentSpec;
B
bryk 已提交
51

52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
/**
 * @typedef {{
 *   namespace: string,
 *   events: !Array<!backendApi.Event>
 * }}
 */
backendApi.Events;

/**
 * @typedef {{
 *   message: string,
 *   sourceComponent: string,
 *   sourceHost: string,
 *   object: string,
 *   count: number,
 *   firstSeen: string,
 *   lastSeen: string,
M
Marcin Maciaszczyk 已提交
69 70
 *   reason: string,
 *   type: string
71 72 73 74
 * }}
 */
backendApi.Event;

B
bryk 已提交
75 76
/**
 * @typedef {{
77
 *   replicaSets: !Array<!backendApi.ReplicaSet>
B
bryk 已提交
78 79
 * }}
 */
80
backendApi.ReplicaSetList;
B
bryk 已提交
81 82 83 84

/**
 * @typedef {{
 *   name: string,
85
 *   namespace: string,
86 87
 *   description: string,
 *   labels: !Object<string, string>,
88
 *   podsRunning: number,
89 90
 *   podsPending: number,
 *   containerImages: !Array<string>,
91
 *   creationTime: string,
92 93
 *   internalEndpoints: !Array<string>,
 *   externalEndpoints: !Array<string>
B
bryk 已提交
94 95
 * }}
 */
96
backendApi.ReplicaSet;
97

98 99 100 101 102 103 104 105 106
/**
 * @typedef {{
 *   name: string,
 *   namespace: string,
 *   labels: !Object<string, string>,
 *   labelSelector: !Object<string, string>,
 *   containerImages: !Array<string>,
 *   podsDesired: number,
 *   podsRunning: number,
107 108
 *   pods: !Array<!backendApi.ReplicaSetPod>,
 *   services: !Array<!backendApi.ServiceDetail>
109 110 111 112
 * }}
 */
backendApi.ReplicaSetDetail;

113 114 115 116 117 118 119
/**
 * @typedef {{
 *   replicas: number
 * }}
 */
backendApi.ReplicaSetSpec;

120 121 122 123 124
/**
 * @typedef {{
 *   name: string,
 *   startTime: ?string,
 *   podIP: string,
125 126
 *   nodeName: string,
 *   restartCount: number
127 128 129 130
 * }}
 */
backendApi.ReplicaSetPod;

131 132 133 134 135 136 137 138 139
/**
 * @typedef {{
 *  internalEndpoint: string,
 *  externalEndpoints: !Array<string>,
 *  selector: !Object<string, string>
 * }}
 */
backendApi.ServiceDetail;

140 141 142 143 144 145 146
/**
 * @typedef {{
 *   name: string
 * }}
 */
backendApi.NamespaceSpec;

147 148 149 150 151 152
/**
 * @typedef {{
 *   namespaces: !Array<string>
 * }}
 */
backendApi.NamespaceList;
153 154 155 156 157 158 159 160

/**
 * @typedef {{
 *  key: string,
 *  value: string
 * }}
 */
backendApi.Label;
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185

/**
 * @typedef {{
 *   name: string,
 *   restartCount: number
 * }}
 */
backendApi.PodContainer;

/**
 * @typedef {{
 *   name: string,
 *   startTime: string,
 *   totalRestartCount: number,
 *   podContainers: !Array<!backendApi.PodContainer>
 * }}
 */
backendApi.ReplicaSetPodWithContainers;

/**
 * @typedef {{
 *   pods: !Array<!backendApi.ReplicaSetPodWithContainers>
 * }}
 */
backendApi.ReplicaSetPods;