github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/apiserver/facades/client/bundle/state.go (about) 1 // Copyright 2018 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package bundle 5 6 import ( 7 "github.com/juju/charm/v12" 8 "github.com/juju/description/v5" 9 10 "github.com/juju/juju/state" 11 ) 12 13 type Backend interface { 14 ExportPartial(cfg state.ExportConfig) (description.Model, error) 15 GetExportConfig() state.ExportConfig 16 Charm(url string) (charm.Charm, error) 17 state.EndpointBinding 18 } 19 20 type stateShim struct { 21 *state.State 22 } 23 24 func (m *stateShim) Charm(url string) (charm.Charm, error) { 25 return m.State.Charm(url) 26 } 27 28 // GetExportConfig implements Backend.GetExportConfig. 29 func (m *stateShim) GetExportConfig() state.ExportConfig { 30 var cfg state.ExportConfig 31 cfg.SkipActions = true 32 cfg.SkipCloudImageMetadata = true 33 cfg.SkipCredentials = true 34 cfg.SkipIPAddresses = true 35 cfg.SkipSSHHostKeys = true 36 cfg.SkipStatusHistory = true 37 cfg.SkipLinkLayerDevices = true 38 cfg.SkipRelationData = true 39 cfg.SkipMachineAgentBinaries = true 40 cfg.SkipUnitAgentBinaries = true 41 cfg.SkipInstanceData = true 42 cfg.SkipExternalControllers = true 43 cfg.SkipSecrets = true 44 45 return cfg 46 } 47 48 // NewStateShim creates new state shim to be used by bundle Facade. 49 func NewStateShim(st *state.State) Backend { 50 return &stateShim{st} 51 }