Documentation
¶
Index ¶
Constants ¶
View Source
const ErrNotLoggedIn = Error("Not authorized. Make sure you log in and your account has the proper privileges")
ErrNotLoggedIn returned when the user is not logged into CPPM yet
View Source
const ErrPageTooSmall = Error("Page size is too small")
ErrPageTooSmall when paginated commands are givel a page size too small (<=0)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Clearpass ¶
type Clearpass interface {
// Login into CPPM. Returns access and refresh tokens, or error.
// - 'address' is the CPPM server address (:port, if different from 443).
// - 'clientID' is the OAuth2 Client ID
// - 'secret' is the OAuth2 Client secret. Empty if client is public (trusted).
// - 'user', 'pass' are the username and password for "password"
// authentication. If any of them is empty, 'client_credentials'
// authentication is used instead.
Login(ctx context.Context, address, clientID, secret, user, pass string) (string, string, error)
// Validate / Refresh credentials.
// - 'address' is the CPPM server address (:port, if different from 443).
// - 'clientID' is the OAuth2 Client ID
// - 'secret' is the OAuth2 Client secret.
// - 'token', 'refresh': the authentication and refresh tokens.
// If a refresh token is provided, attempt to refresh the
// authentication token. Otherwise, just check it is valid.
Validate(ctx context.Context, address, clientID, secret, token, refresh string) (string, string, error)
// Token obtained after authentication / validation
Token() string
// WebLogin into clearpass with the provided credentials, return token.
WebLogin(ctx context.Context, address, username, pass string) ([]*http.Cookie, error)
// WebLogout from clearpass.
WebLogout(ctx context.Context, address string) error
// WebValidate checks the cookie is still useful
WebValidate(ctx context.Context, address string) ([]*http.Cookie, error)
// Cookies obtained after web authentication
Cookies() []*http.Cookie
// Request made to the CPPM.
Request(method Method, path string, params Params, request interface{}) *Reply
// Export some resource from ClearPass, return the exported stream.
Export(ctx context.Context, resource, pass string) (string, io.ReadCloser, error)
// Import some resource to ClearPass.
Import(ctx context.Context, fileName, resource, pass string) error
}
Clearpass server interface
type MAC ¶
type MAC string
MAC address
type Reply ¶
type Reply struct {
// contains filtered or unexported fields
}
Reply is kind of an iterator on rest replies. you can iterate over this with a loop like: r := Request(...)
for r.Next(ctx) {
current := r.Get()
}
if r.Error() != nil {
iteration ended with error
}
Click to show internal directories.
Click to hide internal directories.