1
// Copyright 2014 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
6
// facadeVersions lists the best version of facades that we know about. This
7
// will be used to pick out a default version for communication, given the list
8
// of known versions that the API server tells us it is capable of supporting.
9
// This map should be updated whenever the API server exposes a new version (so
10
// that the client will use it whenever it is available).
11
// New facades should start at 1.
12
// Facades that existed before versioning start at 0.
13
var facadeVersions = map[string]int{
21
"ApplicationScaler": 1,
24
"CharmRevisionUpdater": 2,
34
"FilesystemAttachmentsWatcher": 2,
36
"HighAvailability": 2,
43
"LeadershipService": 2,
57
"MigrationStatusWatcher": 1,
63
"PayloadsHookContext": 1,
68
"RelationUnitsWatcher": 1,
70
"ResourcesHookContext": 1,
78
"StorageProvisioner": 3,
86
"VolumeAttachmentsWatcher": 2,
89
// bestVersion tries to find the newest version in the version list that we can
91
func bestVersion(desiredVersion int, versions []int) int {
93
for _, version := range versions {
94
if version <= desiredVersion && version > best {