File: params.go

package info (click to toggle)
golang-github-juju-aclstore 2.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 156 kB
  • sloc: makefile: 2
file content (77 lines) | stat: -rw-r--r-- 2,391 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright 2018 Canonical Ltd.
// Licensed under the LGPL, see LICENCE file for details.

package params

import "gopkg.in/httprequest.v1"

// SetACLRequest holds parameters for an aclstore.Manager.SetACL call.
type SetACLRequest struct {
	httprequest.Route `httprequest:"PUT /:name"`
	Body              SetACLRequestBody `httprequest:",body"`
	// Name holds the name of the ACL to change.
	Name string `httprequest:"name,path"`
}

// ACLName returns the name of the ACL that's being set.
func (r SetACLRequest) ACLName() string {
	return r.Name
}

// SetACLRequestBody holds the HTTP body for an aclstore.Manager.SetACL call.
type SetACLRequestBody struct {
	Users []string `json:"users"`
}

// ModifyACLRequest holds parameters for an aclstore.Manager.ModifyACL call.
type ModifyACLRequest struct {
	httprequest.Route `httprequest:"POST /:name"`
	Body              ModifyACLRequestBody `httprequest:",body"`
	// Name holds the name of the ACL to change.
	Name string `httprequest:"name,path"`
}

// ACLName returns the name of the ACL that's being modified.
func (r ModifyACLRequest) ACLName() string {
	return r.Name
}

// ModifyACLRequestBody holds the HTTP body for an aclstore.Manager.ModifyACL call.
// It is an error for both Add and Remove to be specified at the same time.
type ModifyACLRequestBody struct {
	// Add specifies users to add to the ACL.
	Add []string `json:"add,omitempty"`
	// Remove specifies users to remove from the ACL.
	Remove []string `json:"remove,omitempty"`
}

// GetACLRequest holds parameters for an aclstore.Manager.GetACL call.
type GetACLRequest struct {
	httprequest.Route `httprequest:"GET /:name"`
	Name              string `httprequest:"name,path"`
}

// ACLName returns the name of the ACL that's being retrieved.
func (r GetACLRequest) ACLName() string {
	return r.Name
}

// GetACLResponse holds the response body returned by an aclstore.Manager.GetACL call.
type GetACLResponse struct {
	Users []string `json:"users"`
}

// GetACLsRequest holds parameters for an aclstore.Manager.GetACLs call.
type GetACLsRequest struct {
	httprequest.Route `httprequest:"GET /"`
}

// ACLName returns the name of the ACL that's being retrieved.
func (r GetACLsRequest) ACLName() string {
	return "admin"
}

// GetACLsResponse holds the response body returned by an aclstore.Manager.GetACLs call.
type GetACLsResponse struct {
	ACLs []string `json:"acls"`
}