github.com/Pankov404/juju@v0.0.0-20150703034450-be266991dceb/apiserver/params/params.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 "fmt" 8 "strings" 9 "time" 10 11 "github.com/juju/errors" 12 "github.com/juju/utils/proxy" 13 "gopkg.in/juju/charm.v5" 14 "gopkg.in/macaroon.v1" 15 16 "github.com/juju/juju/constraints" 17 "github.com/juju/juju/instance" 18 "github.com/juju/juju/state/multiwatcher" 19 "github.com/juju/juju/storage" 20 "github.com/juju/juju/tools" 21 "github.com/juju/juju/utils/ssh" 22 "github.com/juju/juju/version" 23 ) 24 25 // FindTags wraps a slice of strings that are prefixes to use when 26 // searching for matching tags. 27 type FindTags struct { 28 Prefixes []string `json:"prefixes"` 29 } 30 31 // FindTagResults wraps the mapping between the requested prefix and the 32 // matching tags for each requested prefix. 33 type FindTagsResults struct { 34 Matches map[string][]Entity `json:"matches"` 35 } 36 37 // Entity identifies a single entity. 38 type Entity struct { 39 Tag string 40 } 41 42 // Entities identifies multiple entities. 43 type Entities struct { 44 Entities []Entity 45 } 46 47 // EntityPasswords holds the parameters for making a SetPasswords call. 48 type EntityPasswords struct { 49 Changes []EntityPassword 50 } 51 52 // EntityPassword specifies a password change for the entity 53 // with the given tag. 54 type EntityPassword struct { 55 Tag string 56 Password string 57 } 58 59 // ErrorResults holds the results of calling a bulk operation which 60 // returns no data, only an error result. The order and 61 // number of elements matches the operations specified in the request. 62 type ErrorResults struct { 63 // Results contains the error results from each operation. 64 Results []ErrorResult 65 } 66 67 // OneError returns the error from the result 68 // of a bulk operation on a single value. 69 func (result ErrorResults) OneError() error { 70 if n := len(result.Results); n != 1 { 71 return fmt.Errorf("expected 1 result, got %d", n) 72 } 73 if err := result.Results[0].Error; err != nil { 74 return err 75 } 76 return nil 77 } 78 79 // Combine returns one error from the result which is an accumulation of the 80 // errors. If there are no errors in the result, the return value is nil. 81 // Otherwise the error values are combined with new-line characters. 82 func (result ErrorResults) Combine() error { 83 var errorStrings []string 84 for _, r := range result.Results { 85 if r.Error != nil { 86 errorStrings = append(errorStrings, r.Error.Error()) 87 } 88 } 89 if errorStrings != nil { 90 return errors.New(strings.Join(errorStrings, "\n")) 91 } 92 return nil 93 } 94 95 // ErrorResult holds the error status of a single operation. 96 type ErrorResult struct { 97 Error *Error 98 } 99 100 // AddRelation holds the parameters for making the AddRelation call. 101 // The endpoints specified are unordered. 102 type AddRelation struct { 103 Endpoints []string 104 } 105 106 // AddRelationResults holds the results of a AddRelation call. The Endpoints 107 // field maps service names to the involved endpoints. 108 type AddRelationResults struct { 109 Endpoints map[string]charm.Relation 110 } 111 112 // DestroyRelation holds the parameters for making the DestroyRelation call. 113 // The endpoints specified are unordered. 114 type DestroyRelation struct { 115 Endpoints []string 116 } 117 118 // AddCharm holds the arguments for making an AddCharmWithAuthorization API call. 119 type AddCharmWithAuthorization struct { 120 URL string 121 CharmStoreMacaroon *macaroon.Macaroon 122 } 123 124 // AddMachineParams encapsulates the parameters used to create a new machine. 125 type AddMachineParams struct { 126 // The following fields hold attributes that will be given to the 127 // new machine when it is created. 128 Series string `json:"Series"` 129 Constraints constraints.Value `json:"Constraints"` 130 Jobs []multiwatcher.MachineJob `json:"Jobs"` 131 132 // Disks describes constraints for disks that must be attached to 133 // the machine when it is provisioned. 134 Disks []storage.Constraints `json:"Disks"` 135 136 // If Placement is non-nil, it contains a placement directive 137 // that will be used to decide how to instantiate the machine. 138 Placement *instance.Placement `json:"Placement"` 139 140 // If ParentId is non-empty, it specifies the id of the 141 // parent machine within which the new machine will 142 // be created. In that case, ContainerType must also be 143 // set. 144 ParentId string `json:"ParentId"` 145 146 // ContainerType optionally gives the container type of the 147 // new machine. If it is non-empty, the new machine 148 // will be implemented by a container. If it is specified 149 // but ParentId is empty, a new top level machine will 150 // be created to hold the container with given series, 151 // constraints and jobs. 152 ContainerType instance.ContainerType `json:"ContainerType"` 153 154 // If InstanceId is non-empty, it will be associated with 155 // the new machine along with the given nonce, 156 // hardware characteristics and addresses. 157 // All the following fields will be ignored if ContainerType 158 // is set. 159 InstanceId instance.Id `json:"InstanceId"` 160 Nonce string `json:"Nonce"` 161 HardwareCharacteristics instance.HardwareCharacteristics `json:"HardwareCharacteristics"` 162 Addrs []Address `json:"Addrs"` 163 } 164 165 // AddMachines holds the parameters for making the 166 // AddMachinesWithPlacement call. 167 type AddMachines struct { 168 MachineParams []AddMachineParams `json:"MachineParams"` 169 } 170 171 // AddMachinesResults holds the results of an AddMachines call. 172 type AddMachinesResults struct { 173 Machines []AddMachinesResult `json:"Machines"` 174 } 175 176 // AddMachinesResults holds the name of a machine added by the 177 // api.client.AddMachine call for a single machine. 178 type AddMachinesResult struct { 179 Machine string `json:"Machine"` 180 Error *Error `json:"Error"` 181 } 182 183 // DestroyMachines holds parameters for the DestroyMachines call. 184 type DestroyMachines struct { 185 MachineNames []string 186 Force bool 187 } 188 189 // ServicesDeploy holds the parameters for deploying one or more services. 190 type ServicesDeploy struct { 191 Services []ServiceDeploy 192 } 193 194 // ServiceDeploy holds the parameters for making the ServiceDeploy call. 195 type ServiceDeploy struct { 196 ServiceName string 197 CharmUrl string 198 NumUnits int 199 Config map[string]string 200 ConfigYAML string // Takes precedence over config if both are present. 201 Constraints constraints.Value 202 ToMachineSpec string 203 Networks []string 204 Storage map[string]storage.Constraints 205 } 206 207 // ServiceUpdate holds the parameters for making the ServiceUpdate call. 208 type ServiceUpdate struct { 209 ServiceName string 210 CharmUrl string 211 ForceCharmUrl bool 212 MinUnits *int 213 SettingsStrings map[string]string 214 SettingsYAML string // Takes precedence over SettingsStrings if both are present. 215 Constraints *constraints.Value 216 } 217 218 // ServiceSetCharm sets the charm for a given service. 219 type ServiceSetCharm struct { 220 ServiceName string 221 CharmUrl string 222 Force bool 223 } 224 225 // ServiceExpose holds the parameters for making the ServiceExpose call. 226 type ServiceExpose struct { 227 ServiceName string 228 } 229 230 // ServiceSet holds the parameters for a ServiceSet 231 // command. Options contains the configuration data. 232 type ServiceSet struct { 233 ServiceName string 234 Options map[string]string 235 } 236 237 // ServiceSetYAML holds the parameters for 238 // a ServiceSetYAML command. Config contains the 239 // configuration data in YAML format. 240 type ServiceSetYAML struct { 241 ServiceName string 242 Config string 243 } 244 245 // ServiceUnset holds the parameters for a ServiceUnset 246 // command. Options contains the option attribute names 247 // to unset. 248 type ServiceUnset struct { 249 ServiceName string 250 Options []string 251 } 252 253 // ServiceGet holds parameters for making the ServiceGet or 254 // ServiceGetCharmURL calls. 255 type ServiceGet struct { 256 ServiceName string 257 } 258 259 // ServiceGetResults holds results of the ServiceGet call. 260 type ServiceGetResults struct { 261 Service string 262 Charm string 263 Config map[string]interface{} 264 Constraints constraints.Value 265 } 266 267 // ServiceCharmRelations holds parameters for making the ServiceCharmRelations call. 268 type ServiceCharmRelations struct { 269 ServiceName string 270 } 271 272 // ServiceCharmRelationsResults holds the results of the ServiceCharmRelations call. 273 type ServiceCharmRelationsResults struct { 274 CharmRelations []string 275 } 276 277 // ServiceUnexpose holds parameters for the ServiceUnexpose call. 278 type ServiceUnexpose struct { 279 ServiceName string 280 } 281 282 // ServiceMetricCredential holds parameters for the SetServiceCredentials call. 283 type ServiceMetricCredential struct { 284 ServiceName string 285 MetricCredentials []byte 286 } 287 288 // ServiceMetricCredentials holds multiple ServiceMetricCredential parameters. 289 type ServiceMetricCredentials struct { 290 Creds []ServiceMetricCredential 291 } 292 293 // PublicAddress holds parameters for the PublicAddress call. 294 type PublicAddress struct { 295 Target string 296 } 297 298 // PublicAddressResults holds results of the PublicAddress call. 299 type PublicAddressResults struct { 300 PublicAddress string 301 } 302 303 // PrivateAddress holds parameters for the PrivateAddress call. 304 type PrivateAddress struct { 305 Target string 306 } 307 308 // PrivateAddressResults holds results of the PrivateAddress call. 309 type PrivateAddressResults struct { 310 PrivateAddress string 311 } 312 313 // Resolved holds parameters for the Resolved call. 314 type Resolved struct { 315 UnitName string 316 Retry bool 317 } 318 319 // ResolvedResults holds results of the Resolved call. 320 type ResolvedResults struct { 321 Service string 322 Charm string 323 Settings map[string]interface{} 324 } 325 326 // AddServiceUnitsResults holds the names of the units added by the 327 // AddServiceUnits call. 328 type AddServiceUnitsResults struct { 329 Units []string 330 } 331 332 // AddServiceUnits holds parameters for the AddUnits call. 333 type AddServiceUnits struct { 334 ServiceName string 335 NumUnits int 336 ToMachineSpec string 337 } 338 339 // DestroyServiceUnits holds parameters for the DestroyUnits call. 340 type DestroyServiceUnits struct { 341 UnitNames []string 342 } 343 344 // ServiceDestroy holds the parameters for making the ServiceDestroy call. 345 type ServiceDestroy struct { 346 ServiceName string 347 } 348 349 // Creds holds credentials for identifying an entity. 350 type Creds struct { 351 AuthTag string 352 Password string 353 Nonce string 354 } 355 356 // LoginRequest holds credentials for identifying an entity to the Login v1 357 // facade. 358 type LoginRequest struct { 359 AuthTag string `json:"auth-tag"` 360 Credentials string `json:"credentials"` 361 Nonce string `json:"nonce"` 362 } 363 364 // LoginRequestCompat holds credentials for identifying an entity to the Login v1 365 // or earlier (v0 or even pre-facade). 366 type LoginRequestCompat struct { 367 LoginRequest 368 Creds 369 } 370 371 // GetAnnotationsResults holds annotations associated with an entity. 372 type GetAnnotationsResults struct { 373 Annotations map[string]string 374 } 375 376 // GetAnnotations stores parameters for making the GetAnnotations call. 377 type GetAnnotations struct { 378 Tag string 379 } 380 381 // SetAnnotations stores parameters for making the SetAnnotations call. 382 type SetAnnotations struct { 383 Tag string 384 Pairs map[string]string 385 } 386 387 // GetServiceConstraints stores parameters for making the GetServiceConstraints call. 388 type GetServiceConstraints struct { 389 ServiceName string 390 } 391 392 // GetConstraintsResults holds results of the GetConstraints call. 393 type GetConstraintsResults struct { 394 Constraints constraints.Value 395 } 396 397 // SetConstraints stores parameters for making the SetConstraints call. 398 type SetConstraints struct { 399 ServiceName string //optional, if empty, environment constraints are set. 400 Constraints constraints.Value 401 } 402 403 // ResolveCharms stores charm references for a ResolveCharms call. 404 type ResolveCharms struct { 405 References []charm.Reference 406 } 407 408 // ResolveCharmResult holds the result of resolving a charm reference to a URL, or any error that occurred. 409 type ResolveCharmResult struct { 410 URL *charm.URL `json:",omitempty"` 411 Error string `json:",omitempty"` 412 } 413 414 // ResolveCharmResults holds results of the ResolveCharms call. 415 type ResolveCharmResults struct { 416 URLs []ResolveCharmResult 417 } 418 419 // AllWatcherId holds the id of an AllWatcher. 420 type AllWatcherId struct { 421 AllWatcherId string 422 } 423 424 // AllWatcherNextResults holds deltas returned from calling AllWatcher.Next(). 425 type AllWatcherNextResults struct { 426 Deltas []multiwatcher.Delta 427 } 428 429 // ListSSHKeys stores parameters used for a KeyManager.ListKeys call. 430 type ListSSHKeys struct { 431 Entities 432 Mode ssh.ListMode 433 } 434 435 // ModifySSHKeys stores parameters used for a KeyManager.Add|Delete|Import call for a user. 436 type ModifyUserSSHKeys struct { 437 User string 438 Keys []string 439 } 440 441 // StateServingInfo holds information needed by a state 442 // server. 443 type StateServingInfo struct { 444 APIPort int 445 StatePort int 446 // The state server cert and corresponding private key. 447 Cert string 448 PrivateKey string 449 // The private key for the CA cert so that a new state server 450 // cert can be generated when needed. 451 CAPrivateKey string 452 // this will be passed as the KeyFile argument to MongoDB 453 SharedSecret string 454 SystemIdentity string 455 } 456 457 // IsMasterResult holds the result of an IsMaster API call. 458 type IsMasterResult struct { 459 // Master reports whether the connected agent 460 // lives on the same instance as the mongo replica 461 // set master. 462 Master bool 463 } 464 465 // ContainerManagerConfigParams contains the parameters for the 466 // ContainerManagerConfig provisioner API call. 467 type ContainerManagerConfigParams struct { 468 Type instance.ContainerType 469 } 470 471 // ContainerManagerConfig contains information from the environment config 472 // that is needed for configuring the container manager. 473 type ContainerManagerConfig struct { 474 ManagerConfig map[string]string 475 } 476 477 // UpdateBehavior contains settings that are duplicated in several 478 // places. Let's just embed this instead. 479 type UpdateBehavior struct { 480 EnableOSRefreshUpdate bool 481 EnableOSUpgrade bool 482 } 483 484 // ContainerConfig contains information from the environment config that is 485 // needed for container cloud-init. 486 type ContainerConfig struct { 487 ProviderType string 488 AuthorizedKeys string 489 SSLHostnameVerification bool 490 Proxy proxy.Settings 491 AptProxy proxy.Settings 492 AptMirror string 493 PreferIPv6 bool 494 AllowLXCLoopMounts bool 495 *UpdateBehavior 496 } 497 498 // ProvisioningScriptParams contains the parameters for the 499 // ProvisioningScript client API call. 500 type ProvisioningScriptParams struct { 501 MachineId string 502 Nonce string 503 504 // DataDir may be "", in which case the default will be used. 505 DataDir string 506 507 // DisablePackageCommands may be set to disable all 508 // package-related commands. It is then the responsibility of the 509 // provisioner to ensure that all the packages required by Juju 510 // are available. 511 DisablePackageCommands bool 512 } 513 514 // ProvisioningScriptResult contains the result of the 515 // ProvisioningScript client API call. 516 type ProvisioningScriptResult struct { 517 Script string 518 } 519 520 // DeployerConnectionValues containers the result of deployer.ConnectionInfo 521 // API call. 522 type DeployerConnectionValues struct { 523 StateAddresses []string 524 APIAddresses []string 525 } 526 527 // StatusParams holds parameters for the Status call. 528 type StatusParams struct { 529 Patterns []string 530 } 531 532 // SetRsyslogCertParams holds parameters for the SetRsyslogCert call. 533 type SetRsyslogCertParams struct { 534 CACert []byte 535 CAKey []byte 536 } 537 538 // RsyslogConfigResult holds the result of a GetRsyslogConfig call. 539 type RsyslogConfigResult struct { 540 Error *Error `json:"Error"` 541 CACert string `json:"CACert"` 542 CAKey string `json:"CAKey"` 543 // Port is only used by state servers as the port to listen on. 544 // Clients should use HostPorts for the rsyslog addresses to forward 545 // logs to. 546 Port int `json:"Port"` 547 548 HostPorts []HostPort `json:"HostPorts"` 549 } 550 551 // RsyslogConfigResults is the bulk form of RyslogConfigResult 552 type RsyslogConfigResults struct { 553 Results []RsyslogConfigResult 554 } 555 556 // JobsResult holds the jobs for a machine that are returned by a call to Jobs. 557 type JobsResult struct { 558 Jobs []multiwatcher.MachineJob `json:"Jobs"` 559 Error *Error `json:"Error"` 560 } 561 562 // JobsResults holds the result of a call to Jobs. 563 type JobsResults struct { 564 Results []JobsResult `json:"Results"` 565 } 566 567 // DistributionGroupResult contains the result of 568 // the DistributionGroup provisioner API call. 569 type DistributionGroupResult struct { 570 Error *Error 571 Result []instance.Id 572 } 573 574 // DistributionGroupResults is the bulk form of 575 // DistributionGroupResult. 576 type DistributionGroupResults struct { 577 Results []DistributionGroupResult 578 } 579 580 // FacadeVersions describes the available Facades and what versions of each one 581 // are available 582 type FacadeVersions struct { 583 Name string 584 Versions []int 585 } 586 587 // LoginResult holds the result of a Login call. 588 type LoginResult struct { 589 Servers [][]HostPort `json:"Servers"` 590 EnvironTag string `json:"EnvironTag"` 591 LastConnection *time.Time `json:"LastConnection"` 592 Facades []FacadeVersions `json:"Facades"` 593 } 594 595 // ReauthRequest holds a challenge/response token meaningful to the identity 596 // provider. 597 type ReauthRequest struct { 598 Prompt string `json:"prompt"` 599 Nonce string `json:"nonce"` 600 } 601 602 // AuthUserInfo describes a logged-in local user or remote identity. 603 type AuthUserInfo struct { 604 DisplayName string `json:"display-name"` 605 Identity string `json:"identity"` 606 LastConnection *time.Time `json:"last-connection,omitempty"` 607 608 // Credentials contains an optional opaque credential value to be held by 609 // the client, if any. 610 Credentials *string `json:"credentials,omitempty"` 611 } 612 613 // LoginRequestV1 holds the result of an Admin v1 Login call. 614 type LoginResultV1 struct { 615 // Servers is the list of API server addresses. 616 Servers [][]HostPort `json:"servers"` 617 618 // EnvironTag is the tag for the environment that is being connected to. 619 EnvironTag string `json:"environ-tag"` 620 621 // ServerTag is the tag for the environment that holds the API servers. 622 // This is the initial environment created when bootstrapping juju. 623 ServerTag string `json:"server-tag"` 624 625 // ReauthRequest can be used to relay any further authentication handshaking 626 // required on the part of the client to complete the Login, if any. 627 ReauthRequest *ReauthRequest `json:"reauth-request,omitempty"` 628 629 // UserInfo describes the authenticated user, if any. 630 UserInfo *AuthUserInfo `json:"user-info,omitempty"` 631 632 // Facades describes all the available API facade versions to the 633 // authenticated client. 634 Facades []FacadeVersions `json:"facades"` 635 636 // ServerVersion is the string representation of the server version 637 // if the server supports it. 638 ServerVersion string `json:"server-version,omitempty"` 639 } 640 641 // StateServersSpec contains arguments for 642 // the EnsureAvailability client API call. 643 type StateServersSpec struct { 644 EnvironTag string 645 NumStateServers int `json:"num-state-servers"` 646 Constraints constraints.Value `json:"constraints,omitempty"` 647 // Series is the series to associate with new state server machines. 648 // If this is empty, then the environment's default series is used. 649 Series string `json:"series,omitempty"` 650 // Placement defines specific machines to become new state server machines. 651 Placement []string `json:"placement,omitempty"` 652 } 653 654 // StateServersSpecs contains all the arguments 655 // for the EnsureAvailability API call. 656 type StateServersSpecs struct { 657 Specs []StateServersSpec 658 } 659 660 // StateServersChangeResult contains the results 661 // of a single EnsureAvailability API call or 662 // an error. 663 type StateServersChangeResult struct { 664 Result StateServersChanges 665 Error *Error 666 } 667 668 // StateServersChangeResults contains the results 669 // of the EnsureAvailability API call. 670 type StateServersChangeResults struct { 671 Results []StateServersChangeResult 672 } 673 674 // StateServersChange lists the servers 675 // that have been added, removed or maintained in the 676 // pool as a result of an ensure-availability operation. 677 type StateServersChanges struct { 678 Added []string `json:"added,omitempty"` 679 Maintained []string `json:"maintained,omitempty"` 680 Removed []string `json:"removed,omitempty"` 681 Promoted []string `json:"promoted,omitempty"` 682 Demoted []string `json:"demoted,omitempty"` 683 Converted []string `json:"converted,omitempty"` 684 } 685 686 // FindToolsParams defines parameters for the FindTools method. 687 type FindToolsParams struct { 688 // Number will be used to match tools versions exactly if non-zero. 689 Number version.Number 690 691 // MajorVersion will be used to match the major version if non-zero. 692 MajorVersion int 693 694 // MinorVersion will be used to match the major version if greater 695 // than or equal to zero, and Number is zero. 696 MinorVersion int 697 698 // Arch will be used to match tools by architecture if non-empty. 699 Arch string 700 701 // Series will be used to match tools by series if non-empty. 702 Series string 703 } 704 705 // FindToolsResult holds a list of tools from FindTools and any error. 706 type FindToolsResult struct { 707 List tools.List 708 Error *Error 709 } 710 711 // ImageFilterParams holds the parameters used to specify images to delete. 712 type ImageFilterParams struct { 713 Images []ImageSpec `json:"images"` 714 } 715 716 // ImageSpec defines the parameters to select images list or delete. 717 type ImageSpec struct { 718 Kind string `json:"kind"` 719 Arch string `json:"arch"` 720 Series string `json:"series"` 721 } 722 723 // ListImageResult holds the results of querying images. 724 type ListImageResult struct { 725 Result []ImageMetadata `json:"result"` 726 } 727 728 // ImageMetadata represents an image in storage. 729 type ImageMetadata struct { 730 Kind string `json:"kind"` 731 Arch string `json:"arch"` 732 Series string `json:"series"` 733 URL string `json:"url"` 734 Created time.Time `json:"created"` 735 } 736 737 // RebootActionResults holds a list of RebootActionResult and any error. 738 type RebootActionResults struct { 739 Results []RebootActionResult `json:"results,omitempty"` 740 } 741 742 // RebootActionResult holds the result of a single call to 743 // machine.ShouldRebootOrShutdown. 744 type RebootActionResult struct { 745 Result RebootAction `json:"result,omitempty"` 746 Error *Error `json:"error,omitempty"` 747 } 748 749 // Life describes the lifecycle state of an entity ("alive", "dying" or "dead"). 750 type Life multiwatcher.Life 751 752 const ( 753 Alive Life = "alive" 754 Dying Life = "dying" 755 Dead Life = "dead" 756 ) 757 758 // Status represents the status of an entity. 759 // It could be a unit, machine or its agent. 760 type Status multiwatcher.Status 761 762 const ( 763 // Status values common to machine and unit agents. 764 765 // The entity requires human intervention in order to operate 766 // correctly. 767 StatusError Status = "error" 768 769 // The entity is actively participating in the environment. 770 // For unit agents, this is a state we preserve for backwards 771 // compatibility with scripts during the life of Juju 1.x. 772 // In Juju 2.x, the agent-state will remain “active” and scripts 773 // will watch the unit-state instead for signals of service readiness. 774 StatusStarted Status = "started" 775 ) 776 777 const ( 778 // Status values specific to machine agents. 779 780 // The machine is not yet participating in the environment. 781 StatusPending Status = "pending" 782 783 // The machine's agent will perform no further action, other than 784 // to set the unit to Dead at a suitable moment. 785 StatusStopped Status = "stopped" 786 787 // The machine ought to be signalling activity, but it cannot be 788 // detected. 789 StatusDown Status = "down" 790 ) 791 792 const ( 793 // Status values specific to unit agents. 794 795 // The machine on which a unit is to be hosted is still being 796 // spun up in the cloud. 797 StatusAllocating Status = "allocating" 798 799 // The machine on which this agent is running is being rebooted. 800 // The juju-agent should move from rebooting to idle when the reboot is complete. 801 StatusRebooting Status = "rebooting" 802 803 // The agent is running a hook or action. The human-readable message should reflect 804 // which hook or action is being run. 805 StatusExecuting Status = "executing" 806 807 // Once the agent is installed and running it will notify the Juju server and its state 808 // becomes "idle". It will stay "idle" until some action (e.g. it needs to run a hook) or 809 // error (e.g it loses contact with the Juju server) moves it to a different state. 810 StatusIdle Status = "idle" 811 812 // The unit agent has failed in some way,eg the agent ought to be signalling 813 // activity, but it cannot be detected. It might also be that the unit agent 814 // detected an unrecoverable condition and managed to tell the Juju server about it. 815 StatusFailed Status = "failed" 816 817 // The juju agent has has not communicated with the juju server for an unexpectedly long time; 818 // the unit agent ought to be signalling activity, but none has been detected. 819 StatusLost Status = "lost" 820 821 // ---- Outdated ---- 822 // The unit agent is downloading the charm and running the install hook. 823 StatusInstalling Status = "installing" 824 825 // The unit is being destroyed; the agent will soon mark the unit as “dead”. 826 // In Juju 2.x this will describe the state of the agent rather than a unit. 827 StatusStopping Status = "stopping" 828 ) 829 830 const ( 831 // Status values specific to services and units, reflecting the 832 // state of the software itself. 833 834 // The unit is not yet providing services, but is actively doing stuff 835 // in preparation for providing those services. 836 // This is a "spinning" state, not an error state. 837 // It reflects activity on the unit itself, not on peers or related units. 838 StatusMaintenance Status = "maintenance" 839 840 // This unit used to exist, we have a record of it (perhaps because of storage 841 // allocated for it that was flagged to survive it). Nonetheless, it is now gone. 842 StatusTerminated Status = "terminated" 843 844 // A unit-agent has finished calling install, config-changed, and start, 845 // but the charm has not called status-set yet. 846 StatusUnknown Status = "unknown" 847 848 // The unit is unable to progress to an active state because a service to 849 // which it is related is not running. 850 StatusWaiting Status = "waiting" 851 852 // The unit needs manual intervention to get back to the Running state. 853 StatusBlocked Status = "blocked" 854 855 // The unit believes it is correctly offering all the services it has 856 // been asked to offer. 857 StatusActive Status = "active" 858 )