github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/apiserver/params/leadership.go (about) 1 // Copyright 2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package params 5 6 // ClaimLeadershipBulkParams is a collection of parameters for making 7 // a bulk leadership claim. 8 type ClaimLeadershipBulkParams struct { 9 10 // Params are the parameters for making a bulk leadership claim. 11 Params []ClaimLeadershipParams `json:"params"` 12 } 13 14 // ClaimLeadershipParams are the parameters needed for making a 15 // leadership claim. 16 type ClaimLeadershipParams struct { 17 18 // ApplicationTag is the application for which you want to make a 19 // leadership claim. 20 ApplicationTag string `json:"application-tag"` 21 22 // UnitTag is the unit which is making the leadership claim. 23 UnitTag string `json:"unit-tag"` 24 25 // DurationSeconds is the number of seconds for which the lease is required. 26 DurationSeconds float64 `json:"duration"` 27 } 28 29 // ClaimLeadershipBulkResults is the collection of results from a bulk 30 // leadership claim. 31 type ClaimLeadershipBulkResults ErrorResults 32 33 // GetLeadershipSettingsBulkResults is the collection of results from 34 // a bulk request for leadership settings. 35 type GetLeadershipSettingsBulkResults struct { 36 Results []GetLeadershipSettingsResult `json:"results"` 37 } 38 39 // GetLeadershipSettingsResult is the results from requesting 40 // leadership settings. 41 type GetLeadershipSettingsResult struct { 42 Settings Settings `json:"settings"` 43 Error *Error `json:"error,omitempty"` 44 } 45 46 // MergeLeadershipSettingsBulkParams is a collection of parameters for 47 // making a bulk merge of leadership settings. 48 type MergeLeadershipSettingsBulkParams struct { 49 50 // Params are the parameters for making a bulk leadership settings 51 // merge. 52 Params []MergeLeadershipSettingsParam `json:"params"` 53 } 54 55 // MergeLeadershipSettingsParam are the parameters needed for merging 56 // in leadership settings. 57 type MergeLeadershipSettingsParam struct { 58 // ApplicationTag is the application for which you want to merge 59 // leadership settings. 60 ApplicationTag string `json:"application-tag,omitempty"` 61 62 // UnitTag is the unit for which you want to merge 63 // leadership settings. 64 UnitTag string `json:"unit-tag,omitempty"` 65 66 // Settings are the Leadership settings you wish to merge in. 67 Settings Settings `json:"settings"` 68 } 69 70 // PinApplicationsResults returns all applications for which pinning or 71 // unpinning was attempted, including any errors that occurred. 72 type PinApplicationsResults struct { 73 // Results is collection with each application tag and pin/unpin result. 74 Results []PinApplicationResult `json:"results"` 75 } 76 77 // PinApplicationResult represents the result of a single application 78 // leadership pin/unpin operation 79 type PinApplicationResult struct { 80 // ApplicationName is the application for which a leadership pin/unpin 81 // operation was attempted. 82 ApplicationName string `json:"application-name"` 83 // Error will contain a reference to an error resulting from pin/unpin 84 // if one occurred. 85 Error *Error `json:"error,omitempty"` 86 } 87 88 // PinnedLeadershipResults holds data representing the current applications for 89 // which leadership is pinned 90 type PinnedLeadershipResult struct { 91 // Result has: 92 // - Application name keys representing the application pinned. 93 // - Tag slice values representing the entities requiring pinned 94 // behaviour for each application. 95 Result map[string][]string `json:"result,omitempty"` 96 }