github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/state/caasmodel.go (about)

     1  // Copyright 2017 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package state
     5  
     6  import (
     7  	"github.com/juju/errors"
     8  )
     9  
    10  // CAASModel contains functionality that is specific to an
    11  // Containers-As-A-Service (CAAS) model. It embeds a Model so that
    12  // all generic Model functionality is also available.
    13  type CAASModel struct {
    14  	// TODO(caas) - this is all still messy until things shake out.
    15  	*Model
    16  
    17  	mb modelBackend
    18  }
    19  
    20  // CAASModel returns an Containers-As-A-Service (CAAS) model.
    21  func (m *Model) CAASModel() (*CAASModel, error) {
    22  	if m.Type() != ModelTypeCAAS {
    23  		return nil, errors.NotSupportedf("called CAASModel() on a non-CAAS Model")
    24  	}
    25  	return &CAASModel{
    26  		Model: m,
    27  		mb:    m.st,
    28  	}, nil
    29  }