github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/apiserver/facades/agent/provisioner/shim.go (about)

     1  // Copyright 2018 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package provisioner
     5  
     6  import (
     7  	"gopkg.in/juju/charm.v6"
     8  
     9  	"github.com/juju/juju/state"
    10  )
    11  
    12  // ProfileBackend, ProfileMachine, and ProfileCharm are solely to facilitate
    13  // mocks in testing CharmProfileChangeInfo
    14  
    15  type profileBackendShim struct {
    16  	*state.State
    17  }
    18  
    19  type ProfileBackend interface {
    20  	Charm(curl *charm.URL) (ProfileCharm, error)
    21  }
    22  
    23  func (p *profileBackendShim) Charm(curl *charm.URL) (ProfileCharm, error) {
    24  	return p.State.Charm(curl)
    25  }
    26  
    27  type ProfileCharm interface {
    28  	LXDProfile() *charm.LXDProfile
    29  	Meta() *charm.Meta
    30  	Revision() int
    31  }
    32  
    33  type profileMachineShim struct {
    34  	*state.Machine
    35  }
    36  
    37  //go:generate mockgen -package mocks -destination mocks/profile_mock.go github.com/juju/juju/apiserver/facades/agent/provisioner ProfileMachine,ProfileBackend,ProfileCharm
    38  type ProfileMachine interface {
    39  	UpgradeCharmProfileApplication() (string, error)
    40  	UpgradeCharmProfileCharmURL() (string, error)
    41  	CharmProfiles() ([]string, error)
    42  	ModelName() string
    43  	Id() string
    44  }