| 1 | /** |
| 2 | * Licensed to jclouds, Inc. (jclouds) under one or more |
| 3 | * contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. jclouds licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | package org.jclouds.rimuhosting.miro.domain; |
| 20 | |
| 21 | import com.google.gson.annotations.SerializedName; |
| 22 | import org.jclouds.rimuhosting.miro.domain.internal.RimuHostingTimestamp; |
| 23 | import org.jclouds.rimuhosting.miro.domain.internal.RunningState; |
| 24 | |
| 25 | /** |
| 26 | * @author Ivan Meredith |
| 27 | */ |
| 28 | public class ServerInfo { |
| 29 | /** |
| 30 | * Whether the server pinged from the host server. |
| 31 | */ |
| 32 | @SerializedName("pings_ok") |
| 33 | private boolean instancePings; |
| 34 | /** |
| 35 | * The current kernel label. e.g. default is the recommended |
| 36 | * one. |
| 37 | */ |
| 38 | @SerializedName("current_kernel") |
| 39 | private String kernel; |
| 40 | /** |
| 41 | * Some current_kernel labels are symlinks to different |
| 42 | * kernel. e.g. 'default' is a symlink to kernel that we think |
| 43 | * will work best for the host server and its VPSs. Over time |
| 44 | * we may change it (e.g. so it points to a newer server). In |
| 45 | * which case your server would get that new kernel the next time it |
| 46 | * is restarted. Note that to get the new kernel you need to |
| 47 | * restart the server from _outside_ the VPS (i.e. not with a reboot |
| 48 | * command). |
| 49 | */ |
| 50 | @SerializedName("current_kernel_canonical") |
| 51 | private String kernelCanonical; |
| 52 | /** |
| 53 | * The last backup message stored for the VPS. |
| 54 | */ |
| 55 | @SerializedName("last_backup_message") |
| 56 | private String backupMessage; |
| 57 | /** |
| 58 | * Whether the console-over-ssh login feature is enabled. |
| 59 | */ |
| 60 | @SerializedName("is_console_login_enabled") |
| 61 | private boolean isConsoleLoginEnabled; |
| 62 | /** |
| 63 | * The console-over-sshes authorized keys (if they are set). |
| 64 | * Else the console access would be controlled by a password. |
| 65 | */ |
| 66 | @SerializedName("console_public_authorized_keys") |
| 67 | private String consolePublicKeys; |
| 68 | /** |
| 69 | * true when the host server is running a backup of the VPS. |
| 70 | * On new hosts we use LVM file systems so backups can be performed |
| 71 | * by only pausing VPSs for a fraction of a second. |
| 72 | */ |
| 73 | @SerializedName("is_backup_running") |
| 74 | private boolean isBackupRunning; |
| 75 | /** |
| 76 | * true on almost all servers. false when the backups are |
| 77 | * enabled. e.g. if a customer had requested we disable them. |
| 78 | */ |
| 79 | @SerializedName("is_backups_enabled") |
| 80 | private boolean backupsEnabled; |
| 81 | //public boolean is_one_week_backup; |
| 82 | /** |
| 83 | * The time we next expect a backup to run. The actual time |
| 84 | * may be a bit later (e.g. if other VPSs are due to run at this |
| 85 | * time slot). We run VPS backups sequentially (one after the |
| 86 | * other). So if two VPSs were scheduled for a backup at the |
| 87 | * same time one may run a few minutes after the other. |
| 88 | */ |
| 89 | @SerializedName("next_backup_time") |
| 90 | private RimuHostingTimestamp nextBackup; |
| 91 | /** |
| 92 | * How long Xen reports the VPS has been up and running for. |
| 93 | * In seconds. Divide by your time unit of choice :) |
| 94 | */ |
| 95 | @SerializedName("vps_uptime_s") |
| 96 | private long instanceUptime; |
| 97 | /** |
| 98 | * The number of CPU seconds consumed by a VPS. Note that if a |
| 99 | * VPS is using more than one core or CPU then this number can be |
| 100 | * higher than the uptime number. |
| 101 | */ |
| 102 | @SerializedName("vps_cpu_time_s") |
| 103 | private long instanceCpuTime; |
| 104 | /** |
| 105 | * Whether the VPS is, for example, running or not. Typically |
| 106 | * VPSs will all be running. A VPS may be in a non-running |
| 107 | * state, for example, for a short time after its host server is |
| 108 | * restarted. Since we start VPSs sequentially (one after the |
| 109 | * other) to keep server load to a manageable level. |
| 110 | */ |
| 111 | @SerializedName("running_state") |
| 112 | private RunningState state; |
| 113 | /** |
| 114 | * Whether the VPS is marked to not run. e.g. some host server |
| 115 | * operations (like a disk resize) set the suspended state to |
| 116 | * prevent the VPS running or other actions being performed while |
| 117 | * that operation is being performed. Sometimes we may set |
| 118 | * this if the server is 'administratively down', e.g. as a |
| 119 | * consequence of the server breaching our terms of service. |
| 120 | */ |
| 121 | @SerializedName("is_suspended") |
| 122 | private boolean isSuspended; |
| 123 | |
| 124 | public boolean isInstancePings() { |
| 125 | return instancePings; |
| 126 | } |
| 127 | |
| 128 | public void setInstancePings(boolean instancePings) { |
| 129 | this.instancePings = instancePings; |
| 130 | } |
| 131 | |
| 132 | public String getKernel() { |
| 133 | return kernel; |
| 134 | } |
| 135 | |
| 136 | public void setKernel(String kernel) { |
| 137 | this.kernel = kernel; |
| 138 | } |
| 139 | |
| 140 | public String getKernelCanonical() { |
| 141 | return kernelCanonical; |
| 142 | } |
| 143 | |
| 144 | public void setKernelCanonical(String kernelCanonical) { |
| 145 | this.kernelCanonical = kernelCanonical; |
| 146 | } |
| 147 | |
| 148 | public String getBackupMessage() { |
| 149 | return backupMessage; |
| 150 | } |
| 151 | |
| 152 | public void setBackupMessage(String backupMessage) { |
| 153 | this.backupMessage = backupMessage; |
| 154 | } |
| 155 | |
| 156 | public boolean isConsoleLoginEnabled() { |
| 157 | return isConsoleLoginEnabled; |
| 158 | } |
| 159 | |
| 160 | public void setConsoleLoginEnabled(boolean consoleLoginEnabled) { |
| 161 | isConsoleLoginEnabled = consoleLoginEnabled; |
| 162 | } |
| 163 | |
| 164 | public String getConsolePublicKeys() { |
| 165 | return consolePublicKeys; |
| 166 | } |
| 167 | |
| 168 | public void setConsolePublicKeys(String consolePublicKeys) { |
| 169 | this.consolePublicKeys = consolePublicKeys; |
| 170 | } |
| 171 | |
| 172 | public boolean isBackupRunning() { |
| 173 | return isBackupRunning; |
| 174 | } |
| 175 | |
| 176 | public void setBackupRunning(boolean backupRunning) { |
| 177 | isBackupRunning = backupRunning; |
| 178 | } |
| 179 | |
| 180 | public boolean isBackupsEnabled() { |
| 181 | return backupsEnabled; |
| 182 | } |
| 183 | |
| 184 | public void setBackupsEnabled(boolean backupsEnabled) { |
| 185 | this.backupsEnabled = backupsEnabled; |
| 186 | } |
| 187 | |
| 188 | public RimuHostingTimestamp getNextBackup() { |
| 189 | return nextBackup; |
| 190 | } |
| 191 | |
| 192 | public void setNextBackup(RimuHostingTimestamp nextBackup) { |
| 193 | this.nextBackup = nextBackup; |
| 194 | } |
| 195 | |
| 196 | public long getInstanceUptime() { |
| 197 | return instanceUptime; |
| 198 | } |
| 199 | |
| 200 | public void setInstanceUptime(long instanceUptime) { |
| 201 | this.instanceUptime = instanceUptime; |
| 202 | } |
| 203 | |
| 204 | public long getInstanceCpuTime() { |
| 205 | return instanceCpuTime; |
| 206 | } |
| 207 | |
| 208 | public void setInstanceCpuTime(long instanceCpuTime) { |
| 209 | this.instanceCpuTime = instanceCpuTime; |
| 210 | } |
| 211 | |
| 212 | public RunningState getState() { |
| 213 | return state; |
| 214 | } |
| 215 | |
| 216 | public void setState(RunningState state) { |
| 217 | this.state = state; |
| 218 | } |
| 219 | |
| 220 | public boolean isSuspended() { |
| 221 | return isSuspended; |
| 222 | } |
| 223 | |
| 224 | public void setSuspended(boolean suspended) { |
| 225 | isSuspended = suspended; |
| 226 | } |
| 227 | } |