github.com/mwhudson/juju@v0.0.0-20160512215208-90ff01f3497f/provider/common/util.go (about)

     1  // Copyright 2014 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package common
     5  
     6  import "fmt"
     7  
     8  // EnvFullName returns a string based on the provided model
     9  // UUID that is suitable for identifying the env on a provider.
    10  //
    11  // The resulting string clearly associates the value with juju,
    12  // whereas the model's UUID alone isn't very distinctive for humans.
    13  // This benefits users by helping them quickly identify in their
    14  // hosting management tools which instances are juju related.
    15  func EnvFullName(modelUUID string) string {
    16  	return fmt.Sprintf("juju-%s", modelUUID)
    17  }
    18  
    19  // MachineFullName returns a string based on the provided model
    20  // UUID and machine ID that is suitable for identifying instances
    21  // on a provider. See EnvFullName for an explanation on how this
    22  // function helps juju users.
    23  func MachineFullName(modelUUID, machineID string) string {
    24  	modelstr := EnvFullName(modelUUID)
    25  	return fmt.Sprintf("%s-machine-%s", modelstr, machineID)
    26  }