Documentation
¶
Index ¶
- func CharmURLFromLocator(locator applicationcharm.CharmLocator, _ bool) (*charm.URL, error)
- func CharmURLFromLocatorDuringMigration(locator applicationcharm.CharmLocator, includeArchitecture bool) (*charm.URL, error)
- func NewObjectsCharmHTTPHandler(stateGetter StateGetter, applicationServiceGetter ApplicationServiceGetter, ...) http.Handler
- type ApplicationService
- type ApplicationServiceGetter
- type CharmURLMakerFunc
- type Model
- type ModelState
- type ObjectStoreService
- type ObjectStoreServiceGetter
- type ObjectsCharmHTTPHandler
- type ObjectsHTTPHandler
- type StateGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CharmURLFromLocator ¶
func CharmURLFromLocator(locator applicationcharm.CharmLocator, _ bool) (*charm.URL, error)
CharmURLFromLocator returns a charm URL from a charm locator. This will always include the architecture.
func CharmURLFromLocatorDuringMigration ¶
func CharmURLFromLocatorDuringMigration(locator applicationcharm.CharmLocator, includeArchitecture bool) (*charm.URL, error)
CharmURLFromLocatorDuringMigration returns a charm URL from a charm locator during model migration. By including the architecture only when it's passed in, will allow us to move forward with prior versions (3.x) not passing in the architecture and current versions (4.x) passing in the architecture.
func NewObjectsCharmHTTPHandler ¶
func NewObjectsCharmHTTPHandler( stateGetter StateGetter, applicationServiceGetter ApplicationServiceGetter, charmURLMaker CharmURLMakerFunc, ) http.Handler
NewObjectsCharmHTTPHandler returns a new ObjectsCharmHTTPHandler.
Types ¶
type ApplicationService ¶
type ApplicationService interface { // GetCharmArchiveBySHA256Prefix returns a ReadCloser stream for the charm // archive who's SHA256 hash starts with the provided prefix. // // If the charm does not exist, a [applicationerrors.CharmNotFound] error is // returned. GetCharmArchiveBySHA256Prefix(ctx context.Context, sha256Prefix string) (io.ReadCloser, error) // ResolveUploadCharm resolves the upload of a charm archive. ResolveUploadCharm(context.Context, applicationcharm.ResolveUploadCharm) (applicationcharm.CharmLocator, error) }
ApplicationService is an interface for the application domain service.
type ApplicationServiceGetter ¶
type ApplicationServiceGetter interface { // Application returns the model's application service. Application(*http.Request) (ApplicationService, error) }
ApplicationServiceGetter is an interface for getting an ApplicationService.
type CharmURLMakerFunc ¶
type CharmURLMakerFunc func(locator applicationcharm.CharmLocator, includeArchitecture bool) (*charm.URL, error)
CharmURLMakerFunc is a function that creates a charm URL from a charm locator.
type Model ¶
type Model interface {
MigrationMode() state.MigrationMode
}
Model is an interface for getting the model migration mode.
type ModelState ¶
ModelState is an interface for getting the model state.
type ObjectStoreService ¶
type ObjectStoreService interface { // GetBySHA256 returns a reader for the object with the given SHA256 hash. GetBySHA256(ctx context.Context, sha256 string) (io.ReadCloser, int64, error) }
ObjectStoreService is an interface that provides a method to get an object from an object store.
type ObjectStoreServiceGetter ¶
type ObjectStoreServiceGetter interface {
ObjectStore(*http.Request) (ObjectStoreService, error)
}
ObjectStoreServiceGetter is an interface that provides a method to get an object store service.
type ObjectsCharmHTTPHandler ¶
type ObjectsCharmHTTPHandler struct {
// contains filtered or unexported fields
}
ObjectsCharmHTTPHandler is an http.Handler for the "/objects/charms" endpoint.
func (*ObjectsCharmHTTPHandler) ServeGet ¶
func (h *ObjectsCharmHTTPHandler) ServeGet(w http.ResponseWriter, r *http.Request) error
ServeGet serves the GET method for the S3 API. This is the equivalent of the `GetObject` method in the AWS S3 API.
func (*ObjectsCharmHTTPHandler) ServeHTTP ¶
func (h *ObjectsCharmHTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface.
func (*ObjectsCharmHTTPHandler) ServePut ¶
func (h *ObjectsCharmHTTPHandler) ServePut(w http.ResponseWriter, r *http.Request) error
ServePut serves the PUT method for the S3 API. This is the equivalent of the `PutObject` method in the AWS S3 API. Since juju's objects (S3) API only acts as a shim, this method will only rewrite the http request for it to be correctly processed by the legacy '/charms' handler.
type ObjectsHTTPHandler ¶
type ObjectsHTTPHandler struct {
// contains filtered or unexported fields
}
ObjectsHTTPHandler implements the http.Handler interface for the objects API.
func NewObjectsHTTPHandler ¶
func NewObjectsHTTPHandler( objectStoreGetter ObjectStoreServiceGetter, ) *ObjectsHTTPHandler
NewObjectsHTTPHandler returns a new ObjectsHTTPHandler.
func (*ObjectsHTTPHandler) ServeGet ¶
func (h *ObjectsHTTPHandler) ServeGet(w http.ResponseWriter, r *http.Request) error
ServeGet serves the GET method for the S3 API. This is the equivalent of the `GetObject` method in the AWS S3 API.
func (*ObjectsHTTPHandler) ServeHTTP ¶
func (h *ObjectsHTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface.
type StateGetter ¶
type StateGetter interface {
GetState(*http.Request) (ModelState, error)
}
StateGetter is an interface for getting the model state.