github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/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/description"
     8  
     9  	"github.com/juju/juju/state"
    10  )
    11  
    12  type Backend interface {
    13  	ExportPartial(cfg state.ExportConfig) (description.Model, error)
    14  	GetExportConfig() state.ExportConfig
    15  }
    16  
    17  type stateShim struct {
    18  	*state.State
    19  }
    20  
    21  // GetExportConfig implements Backend.GetExportConfig.
    22  func (m *stateShim) GetExportConfig() state.ExportConfig {
    23  	var cfg state.ExportConfig
    24  	cfg.SkipActions = true
    25  	cfg.SkipCloudImageMetadata = true
    26  	cfg.SkipCredentials = true
    27  	cfg.SkipIPAddresses = true
    28  	cfg.SkipSSHHostKeys = true
    29  	cfg.SkipStatusHistory = true
    30  	cfg.SkipLinkLayerDevices = true
    31  	cfg.SkipRelationData = true
    32  	cfg.SkipMachineAgentBinaries = true
    33  	cfg.SkipUnitAgentBinaries = true
    34  	cfg.SkipInstanceData = true
    35  
    36  	return cfg
    37  }
    38  
    39  // NewStateShim creates new state shim to be used by bundle Facade.
    40  func NewStateShim(st *state.State) Backend {
    41  	return &stateShim{st}
    42  }