github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/apiserver/params/applications.go (about) 1 // Copyright 2019 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package params 5 6 import ( 7 "github.com/juju/juju/core/constraints" 8 "github.com/juju/juju/core/devices" 9 "github.com/juju/juju/core/instance" 10 "github.com/juju/juju/core/model" 11 "github.com/juju/juju/storage" 12 ) 13 14 // ApplicationsDeploy holds the parameters for deploying one or more applications. 15 type ApplicationsDeploy struct { 16 Applications []ApplicationDeploy `json:"applications"` 17 } 18 19 // ApplicationDeploy holds the parameters for making the application Deploy call. 20 type ApplicationDeploy struct { 21 ApplicationName string `json:"application"` 22 Series string `json:"series"` 23 CharmURL string `json:"charm-url"` 24 Channel string `json:"channel"` 25 NumUnits int `json:"num-units"` 26 Config map[string]string `json:"config,omitempty"` 27 ConfigYAML string `json:"config-yaml"` // Takes precedence over config if both are present. 28 Constraints constraints.Value `json:"constraints"` 29 Placement []*instance.Placement `json:"placement,omitempty"` 30 Policy string `json:"policy,omitempty"` 31 Storage map[string]storage.Constraints `json:"storage,omitempty"` 32 Devices map[string]devices.Constraints `json:"devices,omitempty"` 33 AttachStorage []string `json:"attach-storage,omitempty"` 34 EndpointBindings map[string]string `json:"endpoint-bindings,omitempty"` 35 Resources map[string]string `json:"resources,omitempty"` 36 } 37 38 // ApplicationsDeployV5 holds the parameters for deploying one or more applications. 39 type ApplicationsDeployV5 struct { 40 Applications []ApplicationDeployV5 `json:"applications"` 41 } 42 43 // ApplicationDeployV5 holds the parameters for making the application Deploy call for 44 // application facades older than v6. Missing the newer Policy arg. 45 type ApplicationDeployV5 struct { 46 ApplicationName string `json:"application"` 47 Series string `json:"series"` 48 CharmURL string `json:"charm-url"` 49 Channel string `json:"channel"` 50 NumUnits int `json:"num-units"` 51 Config map[string]string `json:"config,omitempty"` 52 ConfigYAML string `json:"config-yaml"` // Takes precedence over config if both are present. 53 Constraints constraints.Value `json:"constraints"` 54 Placement []*instance.Placement `json:"placement,omitempty"` 55 Storage map[string]storage.Constraints `json:"storage,omitempty"` 56 AttachStorage []string `json:"attach-storage,omitempty"` 57 EndpointBindings map[string]string `json:"endpoint-bindings,omitempty"` 58 Resources map[string]string `json:"resources,omitempty"` 59 } 60 61 // ApplicationsDeployV6 holds the parameters for deploying one or more applications. 62 type ApplicationsDeployV6 struct { 63 Applications []ApplicationDeployV6 `json:"applications"` 64 } 65 66 // ApplicationDeployV6 holds the parameters for making the application Deploy call for 67 // application facades older than v6. Missing the newer Device arg. 68 type ApplicationDeployV6 struct { 69 ApplicationName string `json:"application"` 70 Series string `json:"series"` 71 CharmURL string `json:"charm-url"` 72 Channel string `json:"channel"` 73 NumUnits int `json:"num-units"` 74 Config map[string]string `json:"config,omitempty"` 75 ConfigYAML string `json:"config-yaml"` // Takes precedence over config if both are present. 76 Constraints constraints.Value `json:"constraints"` 77 Placement []*instance.Placement `json:"placement,omitempty"` 78 Policy string `json:"policy,omitempty"` 79 Storage map[string]storage.Constraints `json:"storage,omitempty"` 80 AttachStorage []string `json:"attach-storage,omitempty"` 81 EndpointBindings map[string]string `json:"endpoint-bindings,omitempty"` 82 Resources map[string]string `json:"resources,omitempty"` 83 } 84 85 // ApplicationUpdate holds the parameters for making the application Update call. 86 type ApplicationUpdate struct { 87 ApplicationName string `json:"application"` 88 CharmURL string `json:"charm-url"` 89 ForceCharmURL bool `json:"force-charm-url"` 90 ForceSeries bool `json:"force-series"` 91 Force bool `json:"force"` 92 MinUnits *int `json:"min-units,omitempty"` 93 SettingsStrings map[string]string `json:"settings,omitempty"` 94 SettingsYAML string `json:"settings-yaml"` // Takes precedence over SettingsStrings if both are present. 95 Constraints *constraints.Value `json:"constraints,omitempty"` 96 97 // Generation is the generation version in which this 98 // request will update the application. 99 Generation model.GenerationVersion `json:"generation"` 100 } 101 102 // ApplicationSetCharm sets the charm for a given application. 103 type ApplicationSetCharm struct { 104 // ApplicationName is the name of the application to set the charm on. 105 ApplicationName string `json:"application"` 106 107 // Generation is the generation version that this 108 // request will set the application charm for. 109 Generation model.GenerationVersion `json:"generation"` 110 111 // CharmURL is the new url for the charm. 112 CharmURL string `json:"charm-url"` 113 114 // Channel is the charm store channel from which the charm came. 115 Channel string `json:"channel"` 116 117 // ConfigSettings is the charm settings to set during the upgrade. 118 // This field is only understood by Application facade version 2 119 // and greater. 120 ConfigSettings map[string]string `json:"config-settings,omitempty"` 121 122 // ConfigSettingsYAML is the charm settings in YAML format to set 123 // during the upgrade. If this is non-empty, it will take precedence 124 // over ConfigSettings. This field is only understood by Application 125 // facade version 2 126 ConfigSettingsYAML string `json:"config-settings-yaml,omitempty"` 127 128 // Force forces the lxd profile validation overriding even if it's fails. 129 Force bool `json:"force"` 130 131 // ForceUnits forces the upgrade on units in an error state. 132 ForceUnits bool `json:"force-units"` 133 134 // ForceSeries forces the use of the charm even if it doesn't match the 135 // series of the unit. 136 ForceSeries bool `json:"force-series"` 137 138 // ResourceIDs is a map of resource names to resource IDs to activate during 139 // the upgrade. 140 ResourceIDs map[string]string `json:"resource-ids,omitempty"` 141 142 // StorageConstraints is a map of storage names to storage constraints to 143 // update during the upgrade. This field is only understood by Application 144 // facade version 2 and greater. 145 StorageConstraints map[string]StorageConstraints `json:"storage-constraints,omitempty"` 146 } 147 148 // ApplicationExpose holds the parameters for making the application Expose call. 149 type ApplicationExpose struct { 150 ApplicationName string `json:"application"` 151 } 152 153 // ApplicationSet holds the parameters for an application Set 154 // command. Options contains the configuration data. 155 type ApplicationSet struct { 156 ApplicationName string `json:"application"` 157 158 // Generation is the generation version that this request 159 // will set application configuration options for. 160 Generation model.GenerationVersion `json:"generation"` 161 162 Options map[string]string `json:"options"` 163 } 164 165 // ApplicationUnset holds the parameters for an application Unset 166 // command. Options contains the option attribute names 167 // to unset. 168 type ApplicationUnset struct { 169 ApplicationName string `json:"application"` 170 171 // Generation is the generation version that this request 172 // will unset application configuration options for. 173 Generation model.GenerationVersion `json:"generation"` 174 175 Options []string `json:"options"` 176 } 177 178 // ApplicationGetArgs is used to request config for 179 // multiple application/generation pairs. 180 type ApplicationGetArgs struct { 181 Args []ApplicationGet `json:"args"` 182 } 183 184 // ApplicationGet holds parameters for making the singular Get or GetCharmURL 185 // calls, and bulk calls to CharmConfig in the V9 API. 186 type ApplicationGet struct { 187 ApplicationName string `json:"application"` 188 189 // Generation is the generation version that this 190 // request will retrieve application data for. 191 Generation model.GenerationVersion `json:"generation"` 192 } 193 194 // ApplicationGetResults holds results of the application Get call. 195 type ApplicationGetResults struct { 196 Application string `json:"application"` 197 Charm string `json:"charm"` 198 CharmConfig map[string]interface{} `json:"config"` 199 ApplicationConfig map[string]interface{} `json:"application-config,omitempty"` 200 Constraints constraints.Value `json:"constraints"` 201 Series string `json:"series"` 202 Channel string `json:"channel"` 203 } 204 205 // ApplicationConfigSetArgs holds the parameters for 206 // setting application config values for specified applications. 207 type ApplicationConfigSetArgs struct { 208 Args []ApplicationConfigSet 209 } 210 211 // ApplicationConfigSet holds the parameters for an application 212 // config set command. 213 type ApplicationConfigSet struct { 214 ApplicationName string `json:"application"` 215 216 // Generation is the generation version that this request 217 // will set application configuration for. 218 Generation model.GenerationVersion `json:"generation"` 219 220 Config map[string]string `json:"config"` 221 } 222 223 // ApplicationConfigUnsetArgs holds the parameters for 224 // resetting application config values for specified applications. 225 type ApplicationConfigUnsetArgs struct { 226 Args []ApplicationUnset 227 } 228 229 // ApplicationCharmRelations holds parameters for making the application CharmRelations call. 230 type ApplicationCharmRelations struct { 231 ApplicationName string `json:"application"` 232 } 233 234 // ApplicationCharmRelationsResults holds the results of the application CharmRelations call. 235 type ApplicationCharmRelationsResults struct { 236 CharmRelations []string `json:"charm-relations"` 237 } 238 239 // ApplicationUnexpose holds parameters for the application Unexpose call. 240 type ApplicationUnexpose struct { 241 ApplicationName string `json:"application"` 242 } 243 244 // ApplicationMetricCredential holds parameters for the SetApplicationCredentials call. 245 type ApplicationMetricCredential struct { 246 ApplicationName string `json:"application"` 247 MetricCredentials []byte `json:"metrics-credentials"` 248 } 249 250 // ApplicationMetricCredentials holds multiple ApplicationMetricCredential parameters. 251 type ApplicationMetricCredentials struct { 252 Creds []ApplicationMetricCredential `json:"creds"` 253 } 254 255 // ApplicationGetConfigResults holds the return values for application GetConfig. 256 type ApplicationGetConfigResults struct { 257 Results []ConfigResult 258 } 259 260 // UpdateApplicationServiceArgs holds the parameters for 261 // updating application services. 262 type UpdateApplicationServiceArgs struct { 263 Args []UpdateApplicationServiceArg `json:"args"` 264 } 265 266 // UpdateApplicationServiceArg holds parameters used to update 267 // an application's service definition for the cloud. 268 type UpdateApplicationServiceArg struct { 269 ApplicationTag string `json:"application-tag"` 270 ProviderId string `json:"provider-id"` 271 Addresses []Address `json:"addresses"` 272 } 273 274 // ApplicationDestroy holds the parameters for making the deprecated 275 // Application.Destroy call. 276 type ApplicationDestroy struct { 277 ApplicationName string `json:"application"` 278 } 279 280 // DestroyApplicationsParams holds bulk parameters for the 281 // Application.DestroyApplication call. 282 type DestroyApplicationsParams struct { 283 Applications []DestroyApplicationParams `json:"applications"` 284 } 285 286 // DestroyApplicationParams holds parameters for the 287 // Application.DestroyApplication call. 288 type DestroyApplicationParams struct { 289 // ApplicationTag holds the tag of the application to destroy. 290 ApplicationTag string `json:"application-tag"` 291 292 // DestroyStorage controls whether or not storage attached to 293 // units of the application should be destroyed. 294 DestroyStorage bool `json:"destroy-storage,omitempty"` 295 } 296 297 // DestroyConsumedApplicationsParams holds bulk parameters for the 298 // Application.DestroyConsumedApplication call. 299 type DestroyConsumedApplicationsParams struct { 300 Applications []DestroyConsumedApplicationParams `json:"applications"` 301 } 302 303 // DestroyConsumedApplicationParams holds the parameters for the 304 // RemoteApplication.Destroy call. 305 type DestroyConsumedApplicationParams struct { 306 ApplicationTag string `json:"application-tag"` 307 } 308 309 // GetApplicationConstraints stores parameters for making the GetApplicationConstraints call. 310 type GetApplicationConstraints struct { 311 ApplicationName string `json:"application"` 312 } 313 314 // ApplicationGetConstraintsResults holds the multiple return values for GetConstraints call. 315 type ApplicationGetConstraintsResults struct { 316 Results []ApplicationConstraint `json:"results"` 317 } 318 319 // ApplicationConstraint holds the constraints value for a single application, or 320 // an error for trying to get it. 321 type ApplicationConstraint struct { 322 Constraints constraints.Value `json:"constraints"` 323 Error *Error `json:"error,omitempty"` 324 } 325 326 // DestroyApplicationResults contains the results of a DestroyApplication 327 // API request. 328 type DestroyApplicationResults struct { 329 Results []DestroyApplicationResult `json:"results,omitempty"` 330 } 331 332 // DestroyApplicationResult contains one of the results of a 333 // DestroyApplication API request. 334 type DestroyApplicationResult struct { 335 Error *Error `json:"error,omitempty"` 336 Info *DestroyApplicationInfo `json:"info,omitempty"` 337 } 338 339 // DestroyApplicationInfo contains information related to the removal of 340 // an application. 341 type DestroyApplicationInfo struct { 342 // DetachedStorage is the tags of storage instances that will be 343 // detached from the application's units, and will remain in the 344 // model after the units are removed. 345 DetachedStorage []Entity `json:"detached-storage,omitempty"` 346 347 // DestroyedStorage is the tags of storage instances that will be 348 // destroyed as a result of destroying the application. 349 DestroyedStorage []Entity `json:"destroyed-storage,omitempty"` 350 351 // DestroyedUnits is the tags of units that will be destroyed 352 // as a result of destroying the application. 353 DestroyedUnits []Entity `json:"destroyed-units,omitempty"` 354 } 355 356 // ScaleApplicationsParams holds bulk parameters for the Application.ScaleApplication call. 357 type ScaleApplicationsParams struct { 358 Applications []ScaleApplicationParams `json:"applications"` 359 } 360 361 // ScaleApplicationParams holds parameters for the Application.ScaleApplication call. 362 type ScaleApplicationParams struct { 363 // ApplicationTag holds the tag of the application to scale. 364 ApplicationTag string `json:"application-tag"` 365 366 // Scale is the number of units which should be running. 367 Scale int `json:"scale"` 368 369 // Scale is the number of units which should be added/removed from the existing count. 370 ScaleChange int `json:"scale-change,omitempty"` 371 } 372 373 // ScaleApplicationResults contains the results of a ScaleApplication 374 // API request. 375 type ScaleApplicationResults struct { 376 Results []ScaleApplicationResult `json:"results,omitempty"` 377 } 378 379 // ScaleApplicationResult contains one of the results of a 380 // ScaleApplication API request. 381 type ScaleApplicationResult struct { 382 Error *Error `json:"error,omitempty"` 383 Info *ScaleApplicationInfo `json:"info,omitempty"` 384 } 385 386 // ScaleApplicationInfo contains information related to the scaling of 387 // an application. 388 type ScaleApplicationInfo struct { 389 // Scale is the number of units which should be running. 390 Scale int `json:"num-units"` 391 } 392 393 // ApplicationInfo holds an application info. 394 type ApplicationInfo struct { 395 Tag string `json:"tag"` 396 Charm string `json:"charm,omitempty"` 397 Series string `json:"series,omitempty"` 398 Channel string `json:"channel,omitempty"` 399 Constraints constraints.Value `json:"constraints,omitempty"` 400 Principal bool `json:"principal"` 401 Exposed bool `json:"exposed"` 402 Remote bool `json:"remote"` 403 EndpointBindings map[string]string `json:"endpoint-bindings,omitempty"` 404 } 405 406 // ApplicationInfoResults holds an application info result or a retrieval error. 407 type ApplicationInfoResult struct { 408 Result *ApplicationInfo `json:"result,omitempty"` 409 Error *Error `json:"error,omitempty"` 410 } 411 412 // ApplicationInfoResults holds applications associated with entities. 413 type ApplicationInfoResults struct { 414 Results []ApplicationInfoResult `json:"results"` 415 }