Documentation ¶
Overview ¶
Package api contains the Cerberus API object definitions This is not a full implementation of every object right now and only defines the needed objects for the client to function. See https://github.com/Nike-Inc/cerberus-management-service/blob/master/API.md for full documentation
Index ¶
- Constants
- Variables
- type AuthStatus
- type Category
- type ErrorDetail
- type ErrorResponse
- type IAMAuthResponse
- type IAMPrincipal
- type MFADevice
- type MetadataResponse
- type Role
- type SDBMetadata
- type SafeDepositBox
- type SecureFileSummary
- type SecureFilesResponse
- type UserAuthData
- type UserAuthResponse
- type UserClientToken
- type UserGroupPermission
- type UserMetadata
Constants ¶
const ClientHeader = "CerberusGoClient/1.0.2"
ClientHeader is the header version for all requests. It should be updated on version bumps
Variables ¶
var ErrorUnauthenticated = fmt.Errorf("Unable to complete request: Not Authenticated")
ErrorUnauthenticated is used when a user tries to Refresh or Logout without already being authenticated
ErrorUnauthorized is returned when the request fails because of invalid credentials
Functions ¶
This section is empty.
Types ¶
type AuthStatus ¶
type AuthStatus string
AuthStatus is the status of a UserAuthResponse
var ( // AuthUserSuccess indicates that the username/password login was successful AuthUserSuccess AuthStatus = "success" // AuthUserNeedsMFA indicates that the username/password login was successful // but an MFA token is required AuthUserNeedsMFA AuthStatus = "mfa_req" )
type Category ¶
type Category struct { ID string DisplayName string `json:"display_name"` Path string Created time.Time `json:"created_ts"` LastUpdated time.Time `json:"last_updated_ts"` CreatedBy string `json:"created_by"` LastUpdatedBy string `json:"last_updated_by"` }
Category represents a category that can be assigned to a safe deposit box
type ErrorDetail ¶
type ErrorDetail struct { Code int Message string Metadata map[string]interface{} // Most of the time it is just a string => string. But the error definition states this as an "Object" in Java, so it could be anything }
ErrorDetail is a specific error description for a given issue. There may be many of these returned with an ErrorResponse
type ErrorResponse ¶
type ErrorResponse struct { ErrorID string `json:"error_id"` Errors []ErrorDetail }
ErrorResponse represents an error response from the API
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
type IAMAuthResponse ¶
type IAMAuthResponse struct { Token string `json:"client_token"` Policies []string Metadata map[string]string Duration int `json:"lease_duration"` Renewable bool }
IAMAuthResponse represents a response from the iam-principal authentication endpoint
type IAMPrincipal ¶ added in v0.2.2
type IAMPrincipal struct { ID string IAMPrincipalARN string `json:"iam_principal_arn"` RoleID string `json:"role_id"` }
IAMPrincipal represents an IAM permission on an object
type MetadataResponse ¶
type MetadataResponse struct { HasNext bool `json:"has_next"` NextOffset int `json:"next_offset"` Limit int Offset int ResultCount int `json:"sdb_count_in_result"` TotalCount int `json:"total_sdbcount"` Metadata []SDBMetadata `json:"safe_deposit_box_metadata"` }
MetadataResponse is an object that wraps a list of SDBMetadata for convenience with pagination
type Role ¶
type Role struct { ID string Name string Created time.Time `json:"created_ts"` LastUpdated time.Time `json:"last_updated_ts"` CreatedBy string `json:"created_by"` LastUpdatedBy string `json:"last_updated_by"` }
Role represents a role that can be assigned to a safe deposit box
type SDBMetadata ¶
type SDBMetadata struct { Name string Path string Category string Owner string Description string Created time.Time `json:"created_ts"` CreatedBy string `json:"created_by"` LastUpdated time.Time `json:"last_updated_ts"` LastUpdatedBy string `json:"last_updated_by"` UserGroupPermissions map[string]string `json:"user_group_permissions"` IAMRolePermissions map[string]string `json:"iam_role_permissions"` }
SDBMetadata represents the metadata of a specific SDB
type SafeDepositBox ¶
type SafeDepositBox struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Path string `json:"path,omitempty"` CategoryID string `json:"category_id,omitempty"` Description string `json:"description,omitempty"` Owner string `json:"owner,omitempty"` UserGroupPermissions []UserGroupPermission `json:"user_group_permissions,omitempty"` IAMPrincipalPermissions []IAMPrincipal `json:"iam_principal_permissions,omitempty"` }
SafeDepositBox represents a safe deposit box API object
type SecureFileSummary ¶ added in v0.4.0
type SecureFileSummary struct { Name string `json:"name"` Path string `json:"path"` Size int `json:"size_in_bytes"` SDBID string `json:"sdbox_id"` Created time.Time `json:"created_ts"` CreatedBy string `json:"created_by"` LastUpdated time.Time `json:"last_updated_ts"` LastUpdatedBy string `json:"last_updated_by"` UserGroupPermissions map[string]string `json:"user_group_permissions"` IAMRolePermissions map[string]string `json:"iam_role_permissions"` }
SecureFileSummary represents the metadata of a specific secure-file
type SecureFilesResponse ¶ added in v0.4.0
type SecureFilesResponse struct { HasNext bool `json:"has_next"` NextOffset int `json:"next_offset"` Limit int Offset int ResultCount int `json:"file_count_in_result"` TotalCount int `json:"total_file_count"` Summaries []SecureFileSummary `json:"secure_file_summaries"` }
SecureFilesResponse is an object that wraps a list of SecureFileSummary for convenience with pagination
type UserAuthData ¶
type UserAuthData struct { ClientToken UserClientToken `json:"client_token"` UserID string `json:"user_id"` Username string StateToken string `json:"state_token"` Devices []MFADevice }
UserAuthData contains user dat for the authentication request or for MFA verification
type UserAuthResponse ¶
type UserAuthResponse struct { Status AuthStatus Data UserAuthData }
UserAuthResponse represents the response from the /v2/auth/user
type UserClientToken ¶
type UserClientToken struct { ClientToken string `json:"client_token"` Policies []string Metadata UserMetadata Duration int `json:"lease_duration"` Renewable bool }
UserClientToken represents the authentication token returned from the API
type UserGroupPermission ¶
type UserGroupPermission struct { ID string Name string `json:"name"` RoleID string `json:"role_id"` }
UserGroupPermission represents a user and group permission on an object
type UserMetadata ¶
UserMetadata represents the user data to which a token belongs