-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move payloads unit context facade to apiserver
This is the final apiserver part to move out of payloads/api. Further cleanups to follow.
- Loading branch information
Menno Smits
committed
Mar 10, 2017
1 parent
6ec0d8f
commit 0a86abf
Showing
12 changed files
with
201 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 29 additions & 29 deletions
58
payload/api/private/data.go → apiserver/params/payloads_unit.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,63 @@ | ||
// Copyright 2015 Canonical Ltd. | ||
// Copyright 2017 Canonical Ltd. | ||
// Licensed under the AGPLv3, see LICENCE file for details. | ||
|
||
package private | ||
package params | ||
|
||
import "github.com/juju/juju/apiserver/params" | ||
|
||
// TrackArgs are the arguments for the Track endpoint. | ||
type TrackArgs struct { | ||
// TrackPayloadArgs are the arguments for the | ||
// PayloadsHookContext.Track endpoint. | ||
type TrackPayloadArgs struct { | ||
// Payloads is the list of Payloads to track | ||
Payloads []params.Payload `json:"payloads"` | ||
Payloads []Payload `json:"payloads"` | ||
} | ||
|
||
// List uses params.Entities. | ||
|
||
// LookUpArgs are the arguments for the LookUp endpoint. | ||
type LookUpArgs struct { | ||
// LookUpPayloadArgs are the arguments for the LookUp endpoint. | ||
type LookUpPayloadArgs struct { | ||
// Args is the list of arguments to pass to this function. | ||
Args []LookUpArg `json:"args"` | ||
Args []LookUpPayloadArg `json:"args"` | ||
} | ||
|
||
// LookUpArg contains all the information necessary to identify a payload. | ||
type LookUpArg struct { | ||
// LookUpPayloadArg contains all the information necessary to identify | ||
// a payload. | ||
type LookUpPayloadArg struct { | ||
// Name is the payload name. | ||
Name string `json:"name"` | ||
|
||
// ID uniquely identifies the payload for the given name. | ||
ID string `json:"id"` | ||
} | ||
|
||
// SetStatusArgs are the arguments for the SetStatus endpoint. | ||
type SetStatusArgs struct { | ||
// SetPayloadStatusArgs are the arguments for the | ||
// PayloadsHookContext.SetStatus endpoint. | ||
type SetPayloadStatusArgs struct { | ||
// Args is the list of arguments to pass to this function. | ||
Args []SetStatusArg `json:"args"` | ||
Args []SetPayloadStatusArg `json:"args"` | ||
} | ||
|
||
// SetStatusArg are the arguments for a single call to the | ||
// SetPayloadStatusArg are the arguments for a single call to the | ||
// SetStatus endpoint. | ||
type SetStatusArg struct { | ||
params.Entity | ||
type SetPayloadStatusArg struct { | ||
Entity | ||
|
||
// Status is the new status of the payload. | ||
Status string `json:"status"` | ||
} | ||
|
||
// Untrack uses params.Entities. | ||
|
||
// PayloadResults is the result for a call that makes one or more requests | ||
// about payloads. | ||
// PayloadResults is the result for a call that makes one or more | ||
// requests about payloads. | ||
type PayloadResults struct { | ||
Results []PayloadResult `json:"results"` | ||
} | ||
|
||
// TODO(ericsnow) Eliminate the NotFound field? | ||
|
||
// PayloadResult contains the result for a single call. | ||
type PayloadResult struct { | ||
params.Entity | ||
Entity | ||
|
||
// Payload holds the details of the payload, if any. | ||
Payload *params.Payload `json:"payload"` | ||
Payload *Payload `json:"payload"` | ||
|
||
// NotFound indicates that the payload was not found in state. | ||
NotFound bool `json:"not-found"` | ||
|
||
// Error is the error (if any) for the call referring to ID. | ||
Error *params.Error `json:"error,omitempty"` | ||
Error *Error `json:"error,omitempty"` | ||
} |
4 changes: 2 additions & 2 deletions
4
payload/api/private/server/package_test.go → ...erver/payloadshookcontext/package_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.