github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/apiserver/params/internal.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package params 5 6 import ( 7 "time" 8 9 "github.com/juju/version" 10 11 "github.com/juju/juju/core/constraints" 12 "github.com/juju/juju/core/instance" 13 "github.com/juju/juju/core/status" 14 "github.com/juju/juju/state/multiwatcher" 15 "github.com/juju/juju/tools" 16 ) 17 18 // MachineContainersParams holds the arguments for making a SetSupportedContainers 19 // API call. 20 type MachineContainersParams struct { 21 Params []MachineContainers `json:"params"` 22 } 23 24 // MachineContainers holds the arguments for making an SetSupportedContainers call 25 // on a given machine. 26 type MachineContainers struct { 27 MachineTag string `json:"machine-tag"` 28 ContainerTypes []instance.ContainerType `json:"container-types"` 29 } 30 31 // WatchContainer identifies a single container type within a machine. 32 type WatchContainer struct { 33 MachineTag string `json:"machine-tag"` 34 ContainerType string `json:"container-type"` 35 } 36 37 // WatchContainers holds the arguments for making a WatchContainers 38 // API call. 39 type WatchContainers struct { 40 Params []WatchContainer `json:"params"` 41 } 42 43 // CharmURL identifies a single charm URL. 44 type CharmURL struct { 45 URL string `json:"url"` 46 } 47 48 // CharmURLs identifies multiple charm URLs. 49 type CharmURLs struct { 50 URLs []CharmURL `json:"urls"` 51 } 52 53 // StringsResult holds the result of an API call that returns a slice 54 // of strings or an error. 55 type StringsResult struct { 56 Error *Error `json:"error,omitempty"` 57 Result []string `json:"result,omitempty"` 58 } 59 60 // StringsResults holds the bulk operation result of an API call 61 // that returns a slice of strings or an error. 62 type StringsResults struct { 63 Results []StringsResult `json:"results"` 64 } 65 66 // StringResult holds a string or an error. 67 type StringResult struct { 68 Error *Error `json:"error,omitempty"` 69 Result string `json:"result"` 70 } 71 72 // StringResults holds the bulk operation result of an API call 73 // that returns a string or an error. 74 type StringResults struct { 75 Results []StringResult `json:"results"` 76 } 77 78 // MapResult holds a generic map or an error. 79 type MapResult struct { 80 Result map[string]interface{} `json:"result"` 81 Error *Error `json:"error,omitempty"` 82 } 83 84 // MapResults holds the bulk operation result of an API call 85 // that returns a map or an error. 86 type MapResults struct { 87 Results []MapResult `json:"results"` 88 } 89 90 // ModelResult holds the result of an API call returning a name and UUID 91 // for a model. 92 type ModelResult struct { 93 Error *Error `json:"error,omitempty"` 94 Name string `json:"name"` 95 UUID string `json:"uuid"` 96 Type string `json:"type"` 97 } 98 99 // ModelCreateArgs holds the arguments that are necessary to create 100 // a model. 101 type ModelCreateArgs struct { 102 // Name is the name for the new model. 103 Name string `json:"name"` 104 105 // OwnerTag represents the user that will own the new model. 106 // The OwnerTag must be a valid user tag. If the user tag represents 107 // a local user, that user must exist. 108 OwnerTag string `json:"owner-tag"` 109 110 // Config defines the model config, which includes the name of the 111 // model. A model UUID is allocated by the API server during the 112 // creation of the model. 113 Config map[string]interface{} `json:"config,omitempty"` 114 115 // CloudTag is the tag of the cloud to create the model in. 116 // If this is empty, the model will be created in the same 117 // cloud as the controller model. 118 CloudTag string `json:"cloud-tag,omitempty"` 119 120 // CloudRegion is the name of the cloud region to create the 121 // model in. If the cloud does not support regions, this must 122 // be empty. If this is empty, and CloudTag is empty, the model 123 // will be created in the same region as the controller model. 124 CloudRegion string `json:"region,omitempty"` 125 126 // CloudCredentialTag is the tag of the cloud credential to use 127 // for managing the model's resources. If the cloud does not 128 // require credentials, this may be empty. If this is empty, 129 // and the owner is the controller owner, the same credential 130 // used for the controller model will be used. 131 CloudCredentialTag string `json:"credential,omitempty"` 132 } 133 134 // Model holds the result of an API call returning a name and UUID 135 // for a model and the tag of the server in which it is running. 136 type Model struct { 137 Name string `json:"name"` 138 UUID string `json:"uuid"` 139 Type string `json:"type"` 140 OwnerTag string `json:"owner-tag"` 141 } 142 143 // UserModel holds information about a model and the last 144 // time the model was accessed for a particular user. 145 type UserModel struct { 146 Model `json:"model"` 147 LastConnection *time.Time `json:"last-connection"` 148 } 149 150 // UserModelList holds information about a list of models 151 // for a particular user. 152 type UserModelList struct { 153 UserModels []UserModel `json:"user-models"` 154 } 155 156 // ResolvedModeResult holds a resolved mode or an error. 157 type ResolvedModeResult struct { 158 Error *Error `json:"error,omitempty"` 159 Mode ResolvedMode `json:"mode"` 160 } 161 162 // ResolvedModeResults holds the bulk operation result of an API call 163 // that returns a resolved mode or an error. 164 type ResolvedModeResults struct { 165 Results []ResolvedModeResult `json:"results"` 166 } 167 168 // StringBoolResult holds the result of an API call that returns a 169 // string and a boolean. 170 type StringBoolResult struct { 171 Error *Error `json:"error,omitempty"` 172 Result string `json:"result"` 173 Ok bool `json:"ok"` 174 } 175 176 // StringBoolResults holds multiple results with a string and a bool 177 // each. 178 type StringBoolResults struct { 179 Results []StringBoolResult `json:"results"` 180 } 181 182 // BoolResult holds the result of an API call that returns a 183 // a boolean or an error. 184 type BoolResult struct { 185 Error *Error `json:"error,omitempty"` 186 Result bool `json:"result"` 187 } 188 189 // BoolResults holds multiple results with BoolResult each. 190 type BoolResults struct { 191 Results []BoolResult `json:"results"` 192 } 193 194 // IntResults holds multiple results with an int in each. 195 type IntResults struct { 196 // Results holds a list of results for calls that return an int or error. 197 Results []IntResult `json:"results"` 198 } 199 200 // IntResult holds the result of an API call that returns a 201 // int or an error. 202 type IntResult struct { 203 // Error holds the error (if any) of this call. 204 Error *Error `json:"error,omitempty"` 205 // Result holds the integer result of the call (if Error is nil). 206 Result int `json:"result"` 207 } 208 209 // Settings holds relation settings names and values. 210 type Settings map[string]string 211 212 // SettingsResult holds a relation settings map or an error. 213 type SettingsResult struct { 214 Error *Error `json:"error,omitempty"` 215 Settings Settings `json:"settings"` 216 } 217 218 // SettingsResults holds the result of an API calls that 219 // returns settings for multiple relations. 220 type SettingsResults struct { 221 Results []SettingsResult `json:"results"` 222 } 223 224 // ConfigSettings holds unit, application or cham configuration settings 225 // with string keys and arbitrary values. 226 type ConfigSettings map[string]interface{} 227 228 // ConfigSettingsResult holds a configuration map or an error. 229 type ConfigSettingsResult struct { 230 Error *Error `json:"error,omitempty"` 231 Settings ConfigSettings `json:"settings"` 232 } 233 234 // ConfigSettingsResults holds multiple configuration maps or errors. 235 type ConfigSettingsResults struct { 236 Results []ConfigSettingsResult `json:"results"` 237 } 238 239 // ModelConfig holds a model configuration. 240 type ModelConfig map[string]interface{} 241 242 // ControllerConfig holds a controller configuration. 243 type ControllerConfig map[string]interface{} 244 245 // ModelConfigResult holds model configuration. 246 type ModelConfigResult struct { 247 Config ModelConfig `json:"config"` 248 } 249 250 // ControllerConfigResult holds controller configuration. 251 type ControllerConfigResult struct { 252 Config ControllerConfig `json:"config"` 253 } 254 255 // ControllerAPIInfoResult holds controller api address details. 256 type ControllerAPIInfoResult struct { 257 Addresses []string `json:"addresses"` 258 CACert string `json:"cacert"` 259 Error *Error `json:"error,omitempty"` 260 } 261 262 // ControllerAPIInfoResults holds controller api address details results. 263 type ControllerAPIInfoResults struct { 264 Results []ControllerAPIInfoResult `json:"results"` 265 } 266 267 // RelationUnit holds a relation and a unit tag. 268 type RelationUnit struct { 269 Relation string `json:"relation"` 270 Unit string `json:"unit"` 271 } 272 273 // RelationUnits holds the parameters for API calls expecting a pair 274 // of relation and unit tags. 275 type RelationUnits struct { 276 RelationUnits []RelationUnit `json:"relation-units"` 277 } 278 279 // RelationIds holds multiple relation ids. 280 type RelationIds struct { 281 RelationIds []int `json:"relation-ids"` 282 } 283 284 // RelationUnitPair holds a relation tag, a local and remote unit tags. 285 type RelationUnitPair struct { 286 Relation string `json:"relation"` 287 LocalUnit string `json:"local-unit"` 288 RemoteUnit string `json:"remote-unit"` 289 } 290 291 // RelationUnitPairs holds the parameters for API calls expecting 292 // multiple sets of a relation tag, a local and remote unit tags. 293 type RelationUnitPairs struct { 294 RelationUnitPairs []RelationUnitPair `json:"relation-unit-pairs"` 295 } 296 297 // RelationUnitSettings holds a relation tag, a unit tag and local 298 // unit settings. 299 type RelationUnitSettings struct { 300 Relation string `json:"relation"` 301 Unit string `json:"unit"` 302 Settings Settings `json:"settings"` 303 } 304 305 // RelationUnitsSettings holds the arguments for making a EnterScope 306 // or WriteSettings API calls. 307 type RelationUnitsSettings struct { 308 RelationUnits []RelationUnitSettings `json:"relation-units"` 309 } 310 311 // RelationResults holds the result of an API call that returns 312 // information about multiple relations. 313 type RelationResults struct { 314 Results []RelationResult `json:"results"` 315 } 316 317 // RelationResult returns information about a single relation, 318 // or an error. 319 type RelationResult struct { 320 Error *Error `json:"error,omitempty"` 321 Life Life `json:"life"` 322 Suspended bool `json:"bool,omitempty"` 323 Id int `json:"id"` 324 Key string `json:"key"` 325 Endpoint multiwatcher.Endpoint `json:"endpoint"` 326 OtherApplication string `json:"other-application,omitempty"` 327 } 328 329 // RelationResultV5 returns information about a single relation, 330 // or an error, but doesn't include the other application name. 331 type RelationResultV5 struct { 332 Error *Error `json:"error,omitempty"` 333 Life Life `json:"life"` 334 Id int `json:"id"` 335 Key string `json:"key"` 336 Endpoint multiwatcher.Endpoint `json:"endpoint"` 337 } 338 339 // RelationResultsV5 holds the result of an API call that returns 340 // information about multiple V5 relations. 341 type RelationResultsV5 struct { 342 Results []RelationResultV5 `json:"results"` 343 } 344 345 // EntityCharmURL holds an entity's tag and a charm URL. 346 type EntityCharmURL struct { 347 Tag string `json:"tag"` 348 CharmURL string `json:"charm-url"` 349 } 350 351 // EntitiesCharmURL holds the parameters for making a SetCharmURL API 352 // call. 353 type EntitiesCharmURL struct { 354 Entities []EntityCharmURL `json:"entities"` 355 } 356 357 // EntityWorkloadVersion holds the workload version for an entity. 358 type EntityWorkloadVersion struct { 359 Tag string `json:"tag"` 360 WorkloadVersion string `json:"workload-version"` 361 } 362 363 // EntityWorkloadVersions holds the parameters for setting the 364 // workload version for a set of entities. 365 type EntityWorkloadVersions struct { 366 Entities []EntityWorkloadVersion `json:"entities"` 367 } 368 369 // BytesResult holds the result of an API call that returns a slice 370 // of bytes. 371 type BytesResult struct { 372 Result []byte `json:"result"` 373 } 374 375 // LifeResult holds the life status of a single entity, or an error 376 // indicating why it is not available. 377 type LifeResult struct { 378 Life Life `json:"life"` 379 Error *Error `json:"error,omitempty"` 380 } 381 382 // LifeResults holds the life or error status of multiple entities. 383 type LifeResults struct { 384 Results []LifeResult `json:"results"` 385 } 386 387 // InstanceInfo holds information about an instance. Instances are 388 // typically virtual machines hosted by a cloud provider but may also 389 // be a container. 390 // 391 // The InstanceInfo struct contains three categories of information: 392 // - interal data, as the machine's tag and the tags of any attached 393 // storage volumes 394 // - naming and other provider-specific information, including the 395 // instance id and display name 396 // - configuration information, including its attached storage volumes, 397 // charm profiles and networking 398 type InstanceInfo struct { 399 Tag string `json:"tag"` 400 InstanceId instance.Id `json:"instance-id"` 401 DisplayName string `json:"display-name"` 402 Nonce string `json:"nonce"` 403 Characteristics *instance.HardwareCharacteristics `json:"characteristics"` 404 Volumes []Volume `json:"volumes"` 405 // VolumeAttachments is a mapping from volume tag to 406 // volume attachment info. 407 VolumeAttachments map[string]VolumeAttachmentInfo `json:"volume-attachments"` 408 409 NetworkConfig []NetworkConfig `json:"network-config"` 410 CharmProfiles []string `json:"charm-profiles"` 411 } 412 413 // InstancesInfo holds the parameters for making a SetInstanceInfo 414 // call for multiple machines. 415 type InstancesInfo struct { 416 Machines []InstanceInfo `json:"machines"` 417 } 418 419 // EntityStatus holds the status of an entity. 420 type EntityStatus struct { 421 Status status.Status `json:"status"` 422 Info string `json:"info"` 423 Data map[string]interface{} `json:"data,omitempty"` 424 Since *time.Time `json:"since"` 425 } 426 427 // EntityStatusArgs holds parameters for setting the status of a single entity. 428 type EntityStatusArgs struct { 429 Tag string `json:"tag"` 430 Status string `json:"status"` 431 Info string `json:"info"` 432 Data map[string]interface{} `json:"data"` 433 } 434 435 // SetStatus holds the parameters for making a SetStatus/UpdateStatus call. 436 type SetStatus struct { 437 Entities []EntityStatusArgs `json:"entities"` 438 } 439 440 // ConstraintsResult holds machine constraints or an error. 441 type ConstraintsResult struct { 442 Error *Error `json:"error,omitempty"` 443 Constraints constraints.Value `json:"constraints"` 444 } 445 446 // ConstraintsResults holds multiple constraints results. 447 type ConstraintsResults struct { 448 Results []ConstraintsResult `json:"results"` 449 } 450 451 // AgentGetEntitiesResults holds the results of a 452 // agent.API.GetEntities call. 453 type AgentGetEntitiesResults struct { 454 Entities []AgentGetEntitiesResult `json:"entities"` 455 } 456 457 // AgentGetEntitiesResult holds the results of a 458 // machineagent.API.GetEntities call for a single entity. 459 type AgentGetEntitiesResult struct { 460 Life Life `json:"life"` 461 Jobs []multiwatcher.MachineJob `json:"jobs"` 462 ContainerType instance.ContainerType `json:"container-type"` 463 Error *Error `json:"error,omitempty"` 464 } 465 466 // VersionResult holds the version and possibly error for a given 467 // DesiredVersion() API call. 468 type VersionResult struct { 469 Version *version.Number `json:"version,omitempty"` 470 Error *Error `json:"error,omitempty"` 471 } 472 473 // VersionResults is a list of versions for the requested entities. 474 type VersionResults struct { 475 Results []VersionResult `json:"results"` 476 } 477 478 // SetModelEnvironVersions holds the tags and associated environ versions 479 // of a collection of models. 480 type SetModelEnvironVersions struct { 481 Models []SetModelEnvironVersion `json:"models,omitempty"` 482 } 483 484 // SetModelEnvironVersions holds the tag and associated environ version 485 // of a model. 486 type SetModelEnvironVersion struct { 487 // ModelTag is the string representation of a model tag, which 488 // should be parseable using names.ParseModelTag. 489 ModelTag string `json:"model-tag"` 490 491 // Version is the environ version to set for the model. 492 Version int `json:"version"` 493 } 494 495 // ToolsResult holds the tools and possibly error for a given 496 // Tools() API call. 497 type ToolsResult struct { 498 ToolsList tools.List `json:"tools"` 499 DisableSSLHostnameVerification bool `json:"disable-ssl-hostname-verification"` 500 Error *Error `json:"error,omitempty"` 501 } 502 503 // ToolsResults is a list of tools for various requested agents. 504 type ToolsResults struct { 505 Results []ToolsResult `json:"results"` 506 } 507 508 // Version holds a specific binary version. 509 type Version struct { 510 Version version.Binary `json:"version"` 511 } 512 513 // EntityVersion specifies the tools version to be set for an entity 514 // with the given tag. 515 // version.Binary directly. 516 type EntityVersion struct { 517 Tag string `json:"tag"` 518 Tools *Version `json:"tools"` 519 } 520 521 // EntitiesVersion specifies what tools are being run for 522 // multiple entities. 523 type EntitiesVersion struct { 524 AgentTools []EntityVersion `json:"agent-tools"` 525 } 526 527 // NotifyWatchResult holds a NotifyWatcher id and an error (if any). 528 type NotifyWatchResult struct { 529 NotifyWatcherId string 530 Error *Error `json:"error,omitempty"` 531 } 532 533 // NotifyWatchResults holds the results for any API call which ends up 534 // returning a list of NotifyWatchers 535 type NotifyWatchResults struct { 536 Results []NotifyWatchResult `json:"results"` 537 } 538 539 // StringsWatchResult holds a StringsWatcher id, changes and an error 540 // (if any). 541 type StringsWatchResult struct { 542 StringsWatcherId string `json:"watcher-id"` 543 Changes []string `json:"changes,omitempty"` 544 Error *Error `json:"error,omitempty"` 545 } 546 547 // StringsWatchResults holds the results for any API call which ends up 548 // returning a list of StringsWatchers. 549 type StringsWatchResults struct { 550 Results []StringsWatchResult `json:"results"` 551 } 552 553 // EntitiesWatchResult holds a EntitiesWatcher id, changes and an error 554 // (if any). 555 type EntitiesWatchResult struct { 556 // Note legacy serialization tag. 557 EntitiesWatcherId string `json:"watcher-id"` 558 Changes []string `json:"changes,omitempty"` 559 Error *Error `json:"error,omitempty"` 560 } 561 562 // EntitiesWatchResults holds the results for any API call which ends up 563 // returning a list of EntitiesWatchers. 564 type EntitiesWatchResults struct { 565 Results []EntitiesWatchResult `json:"results"` 566 } 567 568 // UnitSettings specifies the version of some unit's settings in some relation. 569 type UnitSettings struct { 570 Version int64 `json:"version"` 571 } 572 573 // RelationUnitsChange describes the membership and settings of; or changes to; 574 // some relation scope. 575 type RelationUnitsChange struct { 576 577 // Changed holds a set of units that are known to be in scope, and the 578 // latest known settings version for each. 579 Changed map[string]UnitSettings `json:"changed"` 580 581 // Departed holds a set of units that have previously been reported to 582 // be in scope, but which no longer are. 583 Departed []string `json:"departed,omitempty"` 584 } 585 586 // RelationUnitsWatchResult holds a RelationUnitsWatcher id, baseline state 587 // (in the Changes field), and an error (if any). 588 type RelationUnitsWatchResult struct { 589 RelationUnitsWatcherId string `json:"watcher-id"` 590 Changes RelationUnitsChange `json:"changes"` 591 Error *Error `json:"error,omitempty"` 592 } 593 594 // RelationUnitsWatchResults holds the results for any API call which ends up 595 // returning a list of RelationUnitsWatchers. 596 type RelationUnitsWatchResults struct { 597 Results []RelationUnitsWatchResult `json:"results"` 598 } 599 600 // RelationUnitStatusResult holds details about scope 601 // and suspended status for a relation unit. 602 type RelationUnitStatus struct { 603 RelationTag string `json:"relation-tag"` 604 InScope bool `json:"in-scope"` 605 Suspended bool `json:"suspended"` 606 } 607 608 // RelationUnitStatusResult holds details about scope and status for 609 // relation units, and an error. 610 type RelationUnitStatusResult struct { 611 RelationResults []RelationUnitStatus `json:"results"` 612 Error *Error `json:"error,omitempty"` 613 } 614 615 // RelationUnitStatusResults holds the results of a 616 // uniter RelationStatus API call. 617 type RelationUnitStatusResults struct { 618 Results []RelationUnitStatusResult `json:"results"` 619 } 620 621 // MachineStorageIdsWatchResult holds a MachineStorageIdsWatcher id, 622 // changes and an error (if any). 623 type MachineStorageIdsWatchResult struct { 624 MachineStorageIdsWatcherId string `json:"watcher-id"` 625 Changes []MachineStorageId `json:"changes"` 626 Error *Error `json:"error,omitempty"` 627 } 628 629 // MachineStorageIdsWatchResults holds the results for any API call which ends 630 // up returning a list of MachineStorageIdsWatchers. 631 type MachineStorageIdsWatchResults struct { 632 Results []MachineStorageIdsWatchResult `json:"results"` 633 } 634 635 // CharmsResponse is the server response to charm upload or GET requests. 636 type CharmsResponse struct { 637 Error string `json:"error,omitempty"` 638 639 // ErrorCode holds the code associated with the error. 640 // Ideally, Error would hold an Error object and the 641 // code would be in that, but for backward compatibility, 642 // we cannot do that. 643 ErrorCode string `json:"error-code,omitempty"` 644 645 // ErrorInfo holds extra information associated with the error. 646 // Like ErrorCode, this should really be in an Error object. 647 ErrorInfo *ErrorInfo `json:"error-info,omitempty"` 648 649 CharmURL string `json:"charm-url,omitempty"` 650 Files []string `json:"files,omitempty"` 651 } 652 653 // RunParams is used to provide the parameters to the Run method. 654 // Commands and Timeout are expected to have values, and one or more 655 // values should be in the Machines, Applications, or Units slices. 656 type RunParams struct { 657 Commands string `json:"commands"` 658 Timeout time.Duration `json:"timeout"` 659 Machines []string `json:"machines,omitempty"` 660 Applications []string `json:"applications,omitempty"` 661 Units []string `json:"units,omitempty"` 662 } 663 664 // RunResult contains the result from an individual run call on a machine. 665 // UnitId is populated if the command was run inside the unit context. 666 type RunResult struct { 667 Code int `json:"code-id"` 668 Stdout []byte `json:"stdout,omitempty"` 669 Stderr []byte `json:"stderr,omitempty"` 670 // FIXME: should be tags not id strings 671 MachineId string `json:"machine-id"` 672 UnitId string `json:"unit-id"` 673 Error string `json:"error"` 674 } 675 676 // RunResults is used to return the slice of results. API server side calls 677 // need to return single structure values. 678 type RunResults struct { 679 Results []RunResult `json:"results"` 680 } 681 682 // AgentVersionResult is used to return the current version number of the 683 // agent running the API server. 684 type AgentVersionResult struct { 685 Version version.Number `json:"version"` 686 } 687 688 // ProvisioningInfo holds machine provisioning info. 689 type ProvisioningInfo struct { 690 Constraints constraints.Value `json:"constraints"` 691 Series string `json:"series"` 692 Placement string `json:"placement"` 693 Jobs []multiwatcher.MachineJob `json:"jobs"` 694 Volumes []VolumeParams `json:"volumes,omitempty"` 695 VolumeAttachments []VolumeAttachmentParams `json:"volume-attachments,omitempty"` 696 Tags map[string]string `json:"tags,omitempty"` 697 SubnetsToZones map[string][]string `json:"subnets-to-zones,omitempty"` 698 ImageMetadata []CloudImageMetadata `json:"image-metadata,omitempty"` 699 EndpointBindings map[string]string `json:"endpoint-bindings,omitempty"` 700 ControllerConfig map[string]interface{} `json:"controller-config,omitempty"` 701 CloudInitUserData map[string]interface{} `json:"cloudinit-userdata,omitempty"` 702 CharmLXDProfiles []string `json:"charm-lxd-profiles,omitempty"` 703 } 704 705 // ProvisioningInfoResult holds machine provisioning info or an error. 706 type ProvisioningInfoResult struct { 707 Error *Error `json:"error,omitempty"` 708 Result *ProvisioningInfo `json:"result"` 709 } 710 711 // ProvisioningInfoResults holds multiple machine provisioning info results. 712 type ProvisioningInfoResults struct { 713 Results []ProvisioningInfoResult `json:"results"` 714 } 715 716 // Metric holds a single metric. 717 type Metric struct { 718 Key string `json:"key"` 719 Value string `json:"value"` 720 Time time.Time `json:"time"` 721 Labels map[string]string `json:"labels,omitempty"` 722 } 723 724 // MetricsParam contains the metrics for a single unit. 725 type MetricsParam struct { 726 Tag string `json:"tag"` 727 Metrics []Metric `json:"metrics"` 728 } 729 730 // MetricsParams contains the metrics for multiple units. 731 type MetricsParams struct { 732 Metrics []MetricsParam `json:"metrics"` 733 } 734 735 // MetricBatch is a list of metrics with metadata. 736 type MetricBatch struct { 737 UUID string `json:"uuid"` 738 CharmURL string `json:"charm-url"` 739 Created time.Time `json:"created"` 740 Metrics []Metric `json:"metrics"` 741 } 742 743 // MetricBatchParam contains a single metric batch. 744 type MetricBatchParam struct { 745 Tag string `json:"tag"` 746 Batch MetricBatch `json:"batch"` 747 } 748 749 // MetricBatchParams contains multiple metric batches. 750 type MetricBatchParams struct { 751 Batches []MetricBatchParam `json:"batches"` 752 } 753 754 // MeterStatusResult holds unit meter status or error. 755 type MeterStatusResult struct { 756 Code string `json:"code"` 757 Info string `json:"info"` 758 Error *Error `json:"error,omitempty"` 759 } 760 761 // MeterStatusResults holds meter status results for multiple units. 762 type MeterStatusResults struct { 763 Results []MeterStatusResult `json:"results"` 764 } 765 766 // SingularClaim represents a request for exclusive administrative access 767 // to an entity (model or controller) on the part of the claimaint. 768 type SingularClaim struct { 769 EntityTag string `json:"entity-tag"` 770 ClaimantTag string `json:"claimant-tag"` 771 Duration time.Duration `json:"duration"` 772 } 773 774 // SingularClaims holds any number of SingularClaim~s. 775 type SingularClaims struct { 776 Claims []SingularClaim `json:"claims"` 777 } 778 779 // GUIArchiveVersion holds information on a specific GUI archive version. 780 type GUIArchiveVersion struct { 781 // Version holds the Juju GUI version number. 782 Version version.Number `json:"version"` 783 // SHA256 holds the SHA256 hash of the GUI tar.bz2 archive. 784 SHA256 string `json:"sha256"` 785 // Current holds whether this specific version is the current one served 786 // by the controller. 787 Current bool `json:"current"` 788 } 789 790 // GUIArchiveResponse holds the response to /gui-archive GET requests. 791 type GUIArchiveResponse struct { 792 Versions []GUIArchiveVersion `json:"versions"` 793 } 794 795 // GUIVersionRequest holds the body for /gui-version PUT requests. 796 type GUIVersionRequest struct { 797 // Version holds the Juju GUI version number. 798 Version version.Number `json:"version"` 799 } 800 801 // LogMessage is a structured logging entry. 802 type LogMessage struct { 803 Entity string `json:"tag"` 804 Timestamp time.Time `json:"ts"` 805 Severity string `json:"sev"` 806 Module string `json:"mod"` 807 Location string `json:"loc"` 808 Message string `json:"msg"` 809 } 810 811 // ResourceUploadResult is used to return some details about an 812 // uploaded resource. 813 type ResourceUploadResult struct { 814 // Error will contain details about a failed upload attempt. 815 Error *Error `json:"error,omitempty"` 816 817 // ID uniquely identifies a resource-application pair within the model. 818 ID string `json:"id"` 819 820 // Timestamp indicates when the resource was added to the model. 821 Timestamp time.Time `json:"timestamp"` 822 } 823 824 // UnitRefreshResult is used to return the latest values for attributes 825 // on a unit. 826 type UnitRefreshResult struct { 827 Life Life 828 Resolved ResolvedMode 829 Error *Error 830 } 831 832 // UnitRefreshResults holds the results for any API call which ends 833 // up returning a list of UnitRefreshResult. 834 type UnitRefreshResults struct { 835 Results []UnitRefreshResult 836 } 837 838 // EntityString holds an entity tag and a string value. 839 type EntityString struct { 840 Tag string `json:"tag"` 841 Value string `json:"value"` 842 } 843 844 // SetPodSpecParams holds the arguments for setting the pod 845 // spec for a set of applications. 846 type SetPodSpecParams struct { 847 Specs []EntityString `json:"specs"` 848 } 849 850 // GoalStateResults holds the results of GoalStates API call 851 type GoalStateResults struct { 852 Results []GoalStateResult `json:"results"` 853 } 854 855 // GoalStateResult the result of GoalStates per entity. 856 type GoalStateResult struct { 857 Result *GoalState `json:"result"` 858 Error *Error `json:"error"` 859 } 860 861 // GoalStateStatus goal-state at unit level 862 type GoalStateStatus struct { 863 Status string `json:"status"` 864 Since *time.Time `json:"since"` 865 } 866 867 // UnitsGoalState collection of GoalStatesStatus with unit name 868 type UnitsGoalState map[string]GoalStateStatus 869 870 // GoalState goal-state at application level, stores Units and Units-Relations 871 type GoalState struct { 872 Units UnitsGoalState `json:"units"` 873 Relations map[string]UnitsGoalState `json:"relations"` 874 }