github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/apiserver/facades/controller/caasfirewaller/state.go (about)

     1  // Copyright 2017 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package caasfirewaller
     5  
     6  import (
     7  	"gopkg.in/juju/names.v2"
     8  
     9  	"github.com/juju/juju/core/application"
    10  	"github.com/juju/juju/state"
    11  )
    12  
    13  // CAASUnitProvisionerState provides the subset of global state
    14  // required by the CAAS operator facade.
    15  type CAASFirewallerState interface {
    16  	FindEntity(tag names.Tag) (state.Entity, error)
    17  	Application(string) (Application, error)
    18  	WatchApplications() state.StringsWatcher
    19  }
    20  
    21  // Application provides the subset of application state
    22  // required by the CAAS operator facade.
    23  type Application interface {
    24  	IsExposed() bool
    25  	ApplicationConfig() (application.ConfigAttributes, error)
    26  	Watch() state.NotifyWatcher
    27  }
    28  
    29  type stateShim struct {
    30  	*state.State
    31  }
    32  
    33  func (s stateShim) Application(id string) (Application, error) {
    34  	return s.State.Application(id)
    35  }