Documentation
¶
Overview ¶
Package safeguard provides functionality for building and manipulating API filters. It allows for creating complex query strings with various filtering operations, field selections, and ordering capabilities.
package safeguard provides data structures and operations for interacting with Safeguard entities
Index ¶
- Constants
- func GetLogger() *slog.Logger
- func SetLogger(l *slog.Logger)
- type AccessPolicy
- func (a AccessPolicy) Delete() error
- func (a AccessPolicy) GetApproverSets() ([]ApproverSet, error)
- func (a AccessPolicy) GetReasonCodes() []ReasonCode
- func (a AccessPolicy) GetReviewers() ([]Identity, error)
- func (a AccessPolicy) ModifyApproverSets(operation ApiSetOperation, approverSets []ApproverSet) ([]ApproverSet, error)
- func (a AccessPolicy) ModifyReviewers(operation ApiSetOperation, reviewers []Identity) ([]Identity, error)
- func (a AccessPolicy) SetApproverSets(approverSets []ApproverSet) ([]ApproverSet, error)
- func (a AccessPolicy) SetClient(c *SafeguardClient) any
- func (a AccessPolicy) SetReviewers(reviewers []Identity) ([]Identity, error)
- func (a AccessPolicy) ToJson() (string, error)
- func (a AccessPolicy) Update(updatedAccessPolicy AccessPolicy) (AccessPolicy, error)
- type AccessRequest
- func (ar AccessRequest) Cancel() (AccessRequest, error)
- func (ar AccessRequest) CheckIn() (AccessRequest, error)
- func (ar AccessRequest) CheckOutPassword(ctx context.Context, waitForPending bool) (string, error)
- func (ar AccessRequest) Close() (AccessRequest, error)
- func (ar AccessRequest) GetState() AccessRequestState
- func (ar AccessRequest) IsInvalid() bool
- func (ar AccessRequest) IsPending() bool
- func (ar AccessRequest) IsValid() bool
- func (ar AccessRequest) RefreshState() (AccessRequest, error)
- func (ar AccessRequest) SetClient(c *SafeguardClient) any
- type AccessRequestApprovalBatchResponse
- type AccessRequestBatchResponse
- type AccessRequestDenyBatchResponse
- type AccessRequestProperties
- type AccessRequestReviewBatchResponse
- type AccessRequestRole
- type AccessRequestSession
- type AccessRequestState
- type AccessRequestType
- type AccountEntitlement
- type AccountInfo
- type AccountPasswordRule
- type AccountTaskData
- type ActionableAccessRequests
- type ActionableRequestsResult
- func (r *ActionableRequestsResult) FilterRequestsByState(state AccessRequestState) []AccessRequest
- func (r *ActionableRequestsResult) GetPendingRequests() []AccessRequest
- func (r *ActionableRequestsResult) GetRequestsForRole(role AccessRequestRole) []AccessRequest
- func (r *ActionableRequestsResult) HasRole(role AccessRequestRole) bool
- func (a ActionableRequestsResult) SetClient(c *SafeguardClient) any
- type ActiveRequestInfo
- type ActivityLog
- type ApiError
- type ApiSetOperation
- type ApproverProperties
- type ApproverSet
- type Asset
- func (a Asset) Delete() error
- func (a Asset) GetAccounts(filter Filter) ([]AssetAccount, error)
- func (a Asset) GetDirectoryAccounts(filter Filter) ([]AssetAccount, error)
- func (a Asset) GetDirectoryAssets(filter Filter) ([]Asset, error)
- func (a Asset) GetDirectoryServiceEntries(filter Filter) ([]DirectoryServiceEntry, error)
- func (a Asset) SetClient(c *SafeguardClient) any
- func (a Asset) ToJson() (string, error)
- func (a Asset) Update(updatedAsset Asset) (Asset, error)
- type AssetAccount
- func (a AssetAccount) ChangePassword() (ActivityLog, error)
- func (a AssetAccount) CheckPassword() (ActivityLog, error)
- func (a AssetAccount) Create() (AssetAccount, error)
- func (a AssetAccount) Delete() error
- func (a AssetAccount) Disable() (AssetAccount, error)
- func (a AssetAccount) Enable() (AssetAccount, error)
- func (a AssetAccount) SetClient(c *SafeguardClient) any
- func (a AssetAccount) Suspend() (ActivityLog, error)
- func (a AssetAccount) ToJson() (string, error)
- func (a AssetAccount) Update() (AssetAccount, error)
- func (a AssetAccount) UpdatePasswordProfile(passwordPolicy AccountPasswordRule) (AssetAccount, error)
- type AssetAccountBatchResponse
- type AssetConnectionProperties
- type AssetDirectoryProperties
- type AssetGroup
- type AssetGroupingRule
- type AssetInfo
- type AssetPartition
- type AssetPolicy
- type AssetPolicyMembership
- type AssetSessionAccessProperties
- type AssetSshHostKey
- type AssetTaskProperties
- type AssetType
- type AuthProvider
- type AuthenticationProvider
- type BatchRequest
- type ClientHolder
- type ClusterConnectivityHealthDetail
- type ClusterMember
- type ClusterOperationState
- type ComputerSchemaProperties
- type ConnectionProperties
- type Credentials
- type CustomScriptParameter
- type DateTimeInterval
- type DayOfWeek
- type DirectoryAssetProperties
- type DirectoryConnectionProperties
- type DirectoryDomainController
- type DirectoryGroupSyncProperties
- type DirectoryObjectProperties
- type DirectoryProperties
- type DirectoryServerType
- type DirectoryServiceEntry
- type DirectoryServiceEntryProperty
- type DiscoveredGroup
- type DiscoveredProperties
- type Domain
- type DomainController
- type EmergencyAccessProperties
- type EntitlementType
- type EventData
- type EventHandler
- type ExternalFederation
- type Fido2Authenticator
- type Fido2Properties
- type Fields
- type Filter
- func (f *Filter) AddComplexSearchFilter(value string, fields map[string]FilterOperator)
- func (f *Filter) AddField(field string)
- func (f *Filter) AddFilter(field string, operator FilterOperator, value string)
- func (f *Filter) AddOrderBy(field string)
- func (f *Filter) AddSearchFilter(searchTerm string)
- func (f *Filter) GetFields() Fields
- func (f *Filter) GetOrderBy() OrderBy
- func (f *Filter) RemoveField(field string)
- func (f *Filter) RemoveOrderBy(field string)
- func (f *Filter) ToQueryString() string
- type FilterOperator
- type FilterQueries
- type FilterQuery
- type GroupIdentityProvider
- type GroupProperties
- type GroupSchemaProperties
- type HealthDetail
- type HealthStatus
- type HourlyRestrictionProperties
- type Identity
- type IdentityProvider
- func (idp IdentityProvider) Delete() error
- func (idp IdentityProvider) GetDirectoryGroups(filter Filter) ([]UserGroup, error)
- func (idp IdentityProvider) GetDirectoryUsers(filter Filter) ([]User, error)
- func (a IdentityProvider) SetClient(c *SafeguardClient) any
- func (idp IdentityProvider) Synchronize() (ActivityLog, error)
- func (idp IdentityProvider) Update(updatedIdp IdentityProvider) (IdentityProvider, error)
- type LogEntry
- type NodeConnectivityHealth
- type NodeHealth
- type NodeNetworkInformation
- type NodeResourceHealth
- type NodeResourceHealthDetail
- type NotificationContact
- type NotificationContactType
- type OneLoginMfaProperties
- type OrderBy
- type PasswordChangeSchedule
- type PasswordCheckSchedule
- type Platform
- type PlatformFamily
- type PlatformType
- type PolicyAccount
- type PolicyApproverProperties
- type PolicyAsset
- func (p PolicyAsset) GetAssetGroups(fields Filter) ([]AssetGroup, error)
- func (p PolicyAsset) GetDirectoryServiceEntries(fields Filter) ([]DirectoryServiceEntry, error)
- func (p PolicyAsset) GetPolicies(fields Filter) ([]AssetPolicy, error)
- func (a PolicyAsset) SetClient(c *SafeguardClient) any
- func (p PolicyAsset) ToJson() (string, error)
- type PolicyAssetPlatform
- type PolicyEmergencyAccessProperties
- type PolicyInfo
- type PolicyRequesterProperties
- type PolicyReviewerProperties
- type PolicyScopeItem
- type Preference
- type Profile
- type RSTSAuthResponse
- type RadiusProperties
- type ReasonCode
- type ReasonCodeInfo
- type RegisteredConnector
- type RemoteDesktopApplicationProperties
- type RequestProperties
- type RequestStatus
- type RequesterProperties
- type ReviewerProperties
- type Role
- func (r Role) Delete() error
- func (r Role) GetMembers(filter Filter) ([]Identity, error)
- func (r Role) GetPolicies(filter Filter) ([]AccessPolicy, error)
- func (r Role) ModifyMembers(operation ApiSetOperation, identities []Identity) ([]Identity, error)
- func (a Role) SetClient(c *SafeguardClient) any
- func (u Role) ToJson() (string, error)
- func (r Role) Update(updatedRole Role) (Role, error)
- type RoleMember
- type RuleConditionGroup
- type RuleConditionOrGroup
- type SafeHeaders
- type SafeResponseBody
- type SafeguardClient
- func (c *SafeguardClient) AddIdentityProvider(idp IdentityProvider) (IdentityProvider, error)
- func (c *SafeguardClient) AddLinkedAccounts(user User, policyAccount []PolicyAccount) ([]PolicyAccount, error)
- func (c *SafeguardClient) CancelAccessRequest(id string) (AccessRequest, error)
- func (c *SafeguardClient) CheckInAccessRequest(id string) (AccessRequest, error)
- func (c *SafeguardClient) CheckOutPassword(ctx context.Context, accessRequest AccessRequest, shouldWaitForPending bool) (string, error)
- func (c *SafeguardClient) ClearDefaultAuthProvider() error
- func (c *SafeguardClient) CreateAssetAccount(assetAccount AssetAccount) (AssetAccount, error)
- func (c *SafeguardClient) CreateAssetAccounts(assetAccounts []AssetAccount) ([]AssetAccount, error)
- func (c *SafeguardClient) CreateUser(user User) (User, error)
- func (c *SafeguardClient) DeleteAccessPolicy(id int) error
- func (c *SafeguardClient) DeleteAssetAccount(id int) error
- func (c *SafeguardClient) DeleteAssetGroup(id int) error
- func (c *SafeguardClient) DeleteAssetPartition(id int) error
- func (c *SafeguardClient) DeleteIdentityProvider(id int) error
- func (c *SafeguardClient) DeleteRequest(path string) ([]byte, error)
- func (c *SafeguardClient) DeleteUser(id int) error
- func (c *SafeguardClient) DisableAssetAccount(assetAccount AssetAccount) (AssetAccount, error)
- func (c *SafeguardClient) EnableAssetAccount(assetAccount AssetAccount) (AssetAccount, error)
- func (c *SafeguardClient) ForceAsDefaultAuthProvider(id int) (AuthenticationProvider, error)
- func (c *SafeguardClient) ForceClusterHealthCheck() (ClusterMember, error)
- func (c *SafeguardClient) GetAccessPolicies(filter Filter) ([]AccessPolicy, error)
- func (c *SafeguardClient) GetAccessPolicy(id int, fields Fields) (AccessPolicy, error)
- func (c *SafeguardClient) GetAccessRequest(id string, fields Fields) (AccessRequest, error)
- func (c *SafeguardClient) GetAccessRequests(filter Filter) ([]AccessRequest, error)
- func (c *SafeguardClient) GetAccountTaskSchedules(taskName TaskNames, filter Filter) ([]AccountTaskData, error)
- func (c *SafeguardClient) GetAsset(id int, fields Fields) (Asset, error)
- func (c *SafeguardClient) GetAssetAccount(id int, fields Fields) (AssetAccount, error)
- func (c *SafeguardClient) GetAssetAccounts(filter Filter) ([]AssetAccount, error)
- func (c *SafeguardClient) GetAssetDirectoryAccounts(assetId int, filter Filter) ([]AssetAccount, error)
- func (c *SafeguardClient) GetAssetDirectoryAssets(assetId int, filter Filter) ([]Asset, error)
- func (c *SafeguardClient) GetAssetDirectoryServiceEntries(assetId int, filter Filter) ([]DirectoryServiceEntry, error)
- func (c *SafeguardClient) GetAssetGroup(id int, fields Fields) (AssetGroup, error)
- func (c *SafeguardClient) GetAssetGroups(filter Filter) ([]AssetGroup, error)
- func (c *SafeguardClient) GetAssetPartition(id int, fields Fields) (AssetPartition, error)
- func (c *SafeguardClient) GetAssetPartitions(filter Filter) ([]AssetPartition, error)
- func (c *SafeguardClient) GetAssets(fields Filter) ([]Asset, error)
- func (c *SafeguardClient) GetAuthenticationProvider(id int) (AuthenticationProvider, error)
- func (c *SafeguardClient) GetAuthenticationProviders() ([]AuthenticationProvider, error)
- func (c *SafeguardClient) GetClusterLeader() (ClusterMember, error)
- func (c *SafeguardClient) GetClusterMember(id string) (ClusterMember, error)
- func (c *SafeguardClient) GetClusterMembers(filter Filter) ([]ClusterMember, error)
- func (c *SafeguardClient) GetDirectoryGroups(id int, filter Filter) ([]UserGroup, error)
- func (c *SafeguardClient) GetDirectoryUsers(identityProviderId int, filter Filter) ([]User, error)
- func (c *SafeguardClient) GetEntitlement(id int, fields Fields) (Role, error)
- func (c *SafeguardClient) GetEntitlements(fields Filter) ([]Role, error)
- func (c *SafeguardClient) GetGroups(id string) ([]UserGroup, error)
- func (c *SafeguardClient) GetIdentities(filter Filter) ([]Identity, error)
- func (c *SafeguardClient) GetIdentity(id int, fields Fields) (Identity, error)
- func (c *SafeguardClient) GetIdentityProvider(id int) (IdentityProvider, error)
- func (c *SafeguardClient) GetIdentityProviders() ([]IdentityProvider, error)
- func (c *SafeguardClient) GetLinkedAccounts(id string) ([]PolicyAccount, error)
- func (c *SafeguardClient) GetMe(filter Filter) (User, error)
- func (c *SafeguardClient) GetMeAccessRequestAsset(assetId string) (PolicyAsset, error)
- func (c *SafeguardClient) GetMeAccessRequestAssets(filter Filter) ([]PolicyAsset, error)
- func (c *SafeguardClient) GetMeAccountEntitlements(accessRequestType AccessRequestType, includeActiveRequests bool, ...) ([]AccountEntitlement, error)
- func (c *SafeguardClient) GetMeActionableRequests(filter Filter) (map[AccessRequestRole][]AccessRequest, error)
- func (c *SafeguardClient) GetMeActionableRequestsByRole(role AccessRequestRole, filter Filter) ([]AccessRequest, error)
- func (c *SafeguardClient) GetMeActionableRequestsDetailed(filter Filter) (ActionableRequestsResult, error)
- func (c *SafeguardClient) GetPasswordRules(assetPartition AssetPartition, filter Filter) ([]AccountPasswordRule, error)
- func (c *SafeguardClient) GetPolicyAccount(id int, fields Fields) (PolicyAccount, error)
- func (c *SafeguardClient) GetPolicyAccounts(fields Filter) ([]PolicyAccount, error)
- func (c *SafeguardClient) GetPolicyAsset(id int, fields Fields) (PolicyAsset, error)
- func (c *SafeguardClient) GetPolicyAssets(fields Filter) ([]PolicyAsset, error)
- func (c *SafeguardClient) GetRequest(path string) ([]byte, error)
- func (c *SafeguardClient) GetRole(id int, fields Fields) (Role, error)
- func (c *SafeguardClient) GetRoleMembers(id int, filter Filter) ([]Identity, error)
- func (c *SafeguardClient) GetRolePolicies(id int, filter Filter) ([]AccessPolicy, error)
- func (c *SafeguardClient) GetRoles(fields Filter) ([]Role, error)
- func (c *SafeguardClient) GetTokenExpirationTime() time.Time
- func (c *SafeguardClient) GetUser(id int, fields Fields) (User, error)
- func (c *SafeguardClient) GetUserGroup(id int, fields Fields) (UserGroup, error)
- func (c *SafeguardClient) GetUserGroups(fields Filter) ([]UserGroup, error)
- func (c *SafeguardClient) GetUserPreferences(id int) ([]Preference, error)
- func (c *SafeguardClient) GetUserRoles(id string) ([]Role, error)
- func (c *SafeguardClient) GetUsers(filter Filter) ([]User, error)
- func (c *SafeguardClient) IsTokenExpired() bool
- func (c *SafeguardClient) LoginWithCertificate(certPath, certPassword string) error
- func (c *SafeguardClient) LoginWithOauth() error
- func (c *SafeguardClient) LoginWithPassword(username, password string) error
- func (c *SafeguardClient) NewAccessRequests(accountEntitlements []AccountEntitlement, requestDuration time.Duration) ([]AccessRequestBatchResponse, error)
- func (c *SafeguardClient) NewSignalRClient() *EventHandler
- func (c *SafeguardClient) PostRequest(path string, body io.Reader) ([]byte, error)
- func (c *SafeguardClient) PutRequest(path string, body io.Reader) ([]byte, error)
- func (c *SafeguardClient) RemainingTokenTime() time.Duration
- func (c *SafeguardClient) RemoveLinkedAccounts(user User, policyAccount []PolicyAccount) ([]PolicyAccount, error)
- func (c *SafeguardClient) SaveAccessTokenToEnv() error
- func (c *SafeguardClient) SuspendAssetAccount(a AssetAccount) (ActivityLog, error)
- func (c *SafeguardClient) SynchronizeIdentityProvider(id int) (ActivityLog, error)
- func (c *SafeguardClient) UpdateAccessPolicy(id int, updatedAccessPolicy AccessPolicy) (AccessPolicy, error)
- func (c *SafeguardClient) UpdateAsset(id int, updatedAsset Asset) (Asset, error)
- func (c *SafeguardClient) UpdateAssetAccount(assetAccount AssetAccount) (AssetAccount, error)
- func (c *SafeguardClient) UpdateAssetGroup(id int, assetGroup AssetGroup) (AssetGroup, error)
- func (c *SafeguardClient) UpdateIdentityProvider(id int, updatedIdp IdentityProvider) (IdentityProvider, error)
- func (c *SafeguardClient) UpdatePasswordProfile(assetAccount AssetAccount, passwordPolicy AccountPasswordRule) (AssetAccount, error)
- func (c *SafeguardClient) ValidateAccessToken() error
- type Schedule
- type ScheduleInterval
- type ScheduledAccountTask
- type SchemaProperties
- type ScimProperties
- type ServiceAccountCredentialType
- type SessionAccessAccountType
- type SessionAccessProperties
- type SessionProperties
- type SignalREvent
- type SshKey
- type SshKeyFormat
- type SshKeyType
- type StarlingAssetProperties
- type StarlingProperties
- type SyncGroup
- type Tag
- type TaggingGroupingCondition
- type TaskNames
- type TaskProperties
- type TimeOfDay
- type TimeOfDayInterval
- type TypeReferenceName
- type User
- func (u User) AddLinkedAccounts(policyAccount []PolicyAccount) ([]PolicyAccount, error)
- func (u *User) Delete() error
- func (u User) GetGroups() ([]UserGroup, error)
- func (u User) GetLinkedAccounts() ([]PolicyAccount, error)
- func (u User) GetPreferences() ([]Preference, error)
- func (u User) GetRoles() ([]Role, error)
- func (u User) RemoveLinkedAccounts(policyAccount []PolicyAccount) ([]PolicyAccount, error)
- func (u User) SetAuthenticationProvider(authProvider AuthenticationProvider) (User, error)
- func (a User) SetClient(c *SafeguardClient) any
- func (u User) ToJson() (string, error)
- type UserGroup
- type UserGroupDirectoryProperties
- type UserGroupMember
- type UserInfo
- type UserLogProperties
- type UserProperties
- type UserSchemaProperties
- type UserTemplate
- type WorkflowAction
Constants ¶
const ( // Schedule Types ScheduleTypeOnce = "Once" ScheduleTypeDaily = "Daily" ScheduleTypeWeekly = "Weekly" ScheduleTypeMonthly = "Monthly" // Time of Day Types TimeOfDayTypeAny = "Any" TimeOfDayTypeExact = "Exact" // Monthly Schedule Types MonthlyDayOfMonth = "DayOfMonth" MonthlyDayOfWeek = "DayOfWeek" // Interval Units IntervalUnitMinutes = "Minutes" IntervalUnitHours = "Hours" IntervalUnitDays = "Days" IntervalUnitWeeks = "Weeks" IntervalUnitMonths = "Months" )
Constants for schedule types and intervals
Variables ¶
This section is empty.
Functions ¶
func GetLogger ¶ added in v0.1.5
GetLogger returns the current logger instance. This allows other packages to access the configured logger.
func SetLogger ¶ added in v0.1.5
SetLogger configures the global logger for the safeguard package. This allows other packages to set up logging consistently by providing a fully configured logger instance.
Parameters:
- l: The slog.Logger instance to use. If nil, creates a default logger with Info level.
Example usage from another package:
// Use a simple logger
safeguard.SetLogger(slog.Default())
// Use a custom configured logger
logger := slog.New(slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelDebug}))
safeguard.SetLogger(logger)
// Use a logger with context
logger := slog.With("service", "my-app", "version", "1.0.0")
safeguard.SetLogger(logger)
Types ¶
type AccessPolicy ¶
type AccessPolicy struct {
Id int `json:"Id"`
Name string `json:"Name"`
Description string `json:"Description,omitempty"`
RoleId int `json:"RoleId"`
RoleName string `json:"RoleName"`
RolePriority int `json:"RolePriority"`
Priority int `json:"Priority"`
AccountCount int `json:"AccountCount"`
AssetCount int `json:"AssetCount"`
AccountGroupCount int `json:"AccountGroupCount"`
AssetGroupCount int `json:"AssetGroupCount"`
CreatedDate time.Time `json:"CreatedDate"`
CreatedByUserId int `json:"CreatedByUserId"`
CreatedByUserDisplayName string `json:"CreatedByUserDisplayName"`
RequesterProperties RequesterProperties `json:"RequesterProperties"`
ApproverProperties ApproverProperties `json:"ApproverProperties"`
ReviewerProperties ReviewerProperties `json:"ReviewerProperties"`
AccessRequestProperties AccessRequestProperties `json:"AccessRequestProperties"`
SessionProperties *SessionProperties `json:"SessionProperties,omitempty"`
EmergencyAccessProperties EmergencyAccessProperties `json:"EmergencyAccessProperties"`
ApproverSets []ApproverSet `json:"ApproverSets"`
Reviewers []Identity `json:"Reviewers"`
NotificationContacts []NotificationContact `json:"NotificationContacts"`
ReasonCodes []ReasonCode `json:"ReasonCodes"`
ScopeItems []PolicyScopeItem `json:"ScopeItems"`
ExpirationDate *time.Time `json:"ExpirationDate,omitempty"`
IsExpired bool `json:"IsExpired"`
InvalidConnectionPolicy bool `json:"InvalidConnectionPolicy"`
HourlyRestrictionProperties HourlyRestrictionProperties `json:"HourlyRestrictionProperties"`
// contains filtered or unexported fields
}
AccessPolicy represents security configuration governing the access to assets and accounts
func (AccessPolicy) Delete ¶
func (a AccessPolicy) Delete() error
Delete removes the access policy from the system. It calls the DeleteAccessPolicy function with the client and policy ID. Returns an error if the deletion fails.
func (AccessPolicy) GetApproverSets ¶
func (a AccessPolicy) GetApproverSets() ([]ApproverSet, error)
GetApproverSets retrieves the sets of identities that may approve access requests using this policy.
Returns:
- []ApproverSet: A slice of ApproverSet objects
- error: An error if the request fails
func (AccessPolicy) GetReasonCodes ¶
func (a AccessPolicy) GetReasonCodes() []ReasonCode
GetReasonCodes returns the list of reason codes assigned to this policy. If no reason codes are assigned, it returns an empty slice.
Returns:
- A slice of ReasonCode objects assigned to this policy.
func (AccessPolicy) GetReviewers ¶
func (a AccessPolicy) GetReviewers() ([]Identity, error)
GetReviewers retrieves the list of reviewers for the access policy. It sends a GET request to the API endpoint corresponding to the access policy's reviewers, unmarshals the response into a slice of Identity objects, and returns the slice. If any error occurs during the request or unmarshalling, it returns the error.
Returns:
- A slice of Identity objects representing the reviewers.
- An error if the request or unmarshalling fails.
func (AccessPolicy) ModifyApproverSets ¶
func (a AccessPolicy) ModifyApproverSets(operation ApiSetOperation, approverSets []ApproverSet) ([]ApproverSet, error)
ModifyApproverSets adds or removes approvers who can approve access requests for this policy.
Parameters:
- operation: The operation to perform (Add or Remove)
- approverSets: A slice of ApproverSet objects to modify
Returns:
- []ApproverSet: The updated ApproverSet objects
- error: An error if the request fails
func (AccessPolicy) ModifyReviewers ¶
func (a AccessPolicy) ModifyReviewers(operation ApiSetOperation, reviewers []Identity) ([]Identity, error)
ModifyReviewers modifies the reviewers of an access policy based on the specified operation. It sends a POST request to the API with the updated list of reviewers and returns the updated list.
Parameters:
- operation: The operation to perform on the reviewers (e.g., add or remove).
- reviewers: A slice of Identity objects representing the reviewers to be modified.
Returns:
- A slice of Identity objects representing the updated list of reviewers.
- An error if the operation fails or if there is an issue with the API request.
Example:
updatedReviewers, err := accessPolicy.ModifyReviewers(ApiSetOperationAdd, reviewers)
if err != nil {
log.Fatalf("Failed to modify reviewers: %v", err)
}
func (AccessPolicy) SetApproverSets ¶
func (a AccessPolicy) SetApproverSets(approverSets []ApproverSet) ([]ApproverSet, error)
SetApproverSets sets who can approve access requests for this policy.
Parameters:
- approverSets: A slice of ApproverSet objects to set as approvers
Returns:
- []ApproverSet: The updated ApproverSet objects
- error: An error if the request fails
func (AccessPolicy) SetClient ¶
func (a AccessPolicy) SetClient(c *SafeguardClient) any
func (AccessPolicy) SetReviewers ¶
func (a AccessPolicy) SetReviewers(reviewers []Identity) ([]Identity, error)
SetReviewers sets the reviewers for the access policy. It takes a slice of Identity objects representing the reviewers and returns a slice of modified Identity objects and an error if any occurred.
Parameters:
reviewers - A slice of Identity objects representing the reviewers to be set.
Returns:
A slice of modified Identity objects and an error if any occurred during the process.
The function performs the following steps:
- Constructs the query URL using the access policy ID.
- Marshals the reviewers slice into JSON format.
- Sends a PUT request to the API with the marshaled data.
- Unmarshals the response into a slice of modified Identity objects.
- Adds the API client to the modified reviewers slice and returns it.
func (AccessPolicy) ToJson ¶
func (a AccessPolicy) ToJson() (string, error)
func (AccessPolicy) Update ¶
func (a AccessPolicy) Update(updatedAccessPolicy AccessPolicy) (AccessPolicy, error)
Update updates this AccessPolicy with the provided updates. It sends a request to update the AccessPolicy identified by this AccessPolicy's ID with the details from updatedAccessPolicy.
Parameters:
- updatedAccessPolicy: The AccessPolicy object containing the updated fields
Returns:
- AccessPolicy: The updated AccessPolicy object
- error: An error if the update operation fails, nil otherwise
type AccessRequest ¶
type AccessRequest struct {
Id string `json:"Id,omitempty"`
AccessRequestType AccessRequestType `json:"AccessRequestType,omitempty"`
AccountId int `json:"AccountId,omitempty"`
AccountName string `json:"AccountName,omitempty"`
AccountDomainName string `json:"AccountDomainName,omitempty"`
AccountAssetId int `json:"AccountAssetId,omitempty"`
AccountAssetName string `json:"AccountAssetName,omitempty"`
AccountHasTotpAuthenticator bool `json:"AccountHasTotpAuthenticator,omitempty"`
AccountRequestType string `json:"AccountRequestType,omitempty"`
ApprovedByMe bool `json:"ApprovedByMe,omitempty"`
AssetId int `json:"AssetId,omitempty"`
AssetName string `json:"AssetName,omitempty"`
AssetNetworkAddress *string `json:"AssetNetworkAddress,omitempty"`
AssetSshHostKey *string `json:"AssetSshHostKey,omitempty"`
AssetSshHostKeyFingerprint *string `json:"AssetSshHostKeyFingerprint,omitempty"`
AssetSshHostKeyFingerprintSha256 *string `json:"AssetSshHostKeyFingerprintSha256,omitempty"`
CreatedOn time.Time `json:"CreatedOn,omitempty"`
CurrentApprovalCount int `json:"CurrentApprovalCount,omitempty"`
CurrentReviewerCount int `json:"CurrentReviewerCount,omitempty"`
DurationInMinutes int `json:"DurationInMinutes,omitempty"`
ExpiresOn time.Time `json:"ExpiresOn,omitempty"`
IsEmergency bool `json:"IsEmergency,omitempty"`
NeedsAcknowledgement bool `json:"NeedsAcknowledgement,omitempty"`
RequestAvailability []DateTimeInterval `json:"RequestAvailability,omitempty"`
ReasonCode *ReasonCodeInfo `json:"ReasonCode,omitempty"`
ReasonComment *string `json:"ReasonComment,omitempty"`
RequestedDurationDays int `json:"RequestedDurationDays,omitempty"`
RequestedDurationHours int `json:"RequestedDurationHours,omitempty"`
RequestedDurationMinutes int `json:"RequestedDurationMinutes,omitempty"`
RequestedFor string `json:"RequestedFor,omitempty"`
RequesterDisplayName string `json:"RequesterDisplayName,omitempty"`
RequesterEmailAddress string `json:"RequesterEmailAddress,omitempty"`
RequesterId int `json:"RequesterId,omitempty"`
RequesterUsername string `json:"RequesterUsername,omitempty"`
RequiredApprovalCount int `json:"RequiredApprovalCount,omitempty"`
RequiredReviewerCount int `json:"RequiredReviewerCount,omitempty"`
State AccessRequestState `json:"State,omitempty"`
StateChangedOn time.Time `json:"StateChangedOn,omitempty"`
TicketNumber *string `json:"TicketNumber,omitempty"`
WasCancelled bool `json:"WasCancelled,omitempty"`
WasCheckedOut bool `json:"WasCheckedOut,omitempty"`
WasDenied bool `json:"WasDenied,omitempty"`
WasEvicted bool `json:"WasEvicted,omitempty"`
WasExpired bool `json:"WasExpired,omitempty"`
WasRevoked bool `json:"WasRevoked,omitempty"`
WorkflowActions []WorkflowAction `json:"WorkflowActions,omitempty"`
PolicyId int `json:"PolicyId,omitempty"`
PolicyName string `json:"PolicyName,omitempty"`
RequireReviewerComment bool `json:"RequireReviewerComment,omitempty"`
AllowSraSessionLaunch bool `json:"AllowSraSessionLaunch,omitempty"`
AllowSessionPasswordRelease bool `json:"AllowSessionPasswordRelease,omitempty"`
AllowSessionSshKeyRelease bool `json:"AllowSessionSshKeyRelease,omitempty"`
IncludePasswordRelease bool `json:"IncludePasswordRelease,omitempty"`
IncludeSshKeyRelease bool `json:"IncludeSshKeyRelease,omitempty"`
Sessions []AccessRequestSession `json:"Sessions,omitempty"`
AccountDistinguishedName string `json:"AccountDistinguishedName,omitempty"`
AssetPlatformId int `json:"AssetPlatformId,omitempty"`
AssetPlatformType string `json:"AssetPlatformType,omitempty"`
AssetPlatformDisplayName string `json:"AssetPlatformDisplayName,omitempty"`
AllowSubsequentAccessRequestsWithoutReview bool `json:"AllowSubsequentAccessRequestsWithoutReview,omitempty"`
SessionModuleConnectionId int `json:"SessionModuleConnectionId,omitempty"`
SessionConnectionPolicyRef string `json:"SessionConnectionPolicyRef,omitempty"`
SessionRdpShowWallpaper bool `json:"SessionRdpShowWallpaper,omitempty"`
// contains filtered or unexported fields
}
AccessRequest represents a request for access to an asset or account
func (AccessRequest) Cancel ¶
func (ar AccessRequest) Cancel() (AccessRequest, error)
Cancel cancels a pending or available access request.
Returns:
- AccessRequest: The updated access request showing canceled state.
- error: An error if the cancellation fails.
func (AccessRequest) CheckIn ¶
func (ar AccessRequest) CheckIn() (AccessRequest, error)
CheckIn checks in a checked-out password access request.
Returns:
- AccessRequest: The updated access request showing checked-in state.
- error: An error if the check-in fails.
func (AccessRequest) CheckOutPassword ¶
CheckOutPassword retrieves the password for the request, optionally waiting for pending requests to become available.
Parameters:
- ctx: Context for cancellation/timeout
- waitForPending: Whether to wait for pending state
Returns:
- string: The password if successful
- error: Checkout or timeout errors
func (AccessRequest) Close ¶
func (ar AccessRequest) Close() (AccessRequest, error)
Close attempts to close the request based on its current state. For checked out passwords, checks them back in. For pending/available requests, cancels them. Returns error for invalid states.
Returns:
- AccessRequest: Updated request state
- error: Any errors during close
func (AccessRequest) GetState ¶
func (ar AccessRequest) GetState() AccessRequestState
func (AccessRequest) IsInvalid ¶
func (ar AccessRequest) IsInvalid() bool
IsInvalid checks if the access request is in a terminal or invalid state.
Returns:
- bool: true if request is completed, expired, denied, canceled or revoked.
func (AccessRequest) IsPending ¶
func (ar AccessRequest) IsPending() bool
IsPending checks if the access request is in any pending state.
Returns:
- bool: true if request is pending approval, review, or other pending states.
func (AccessRequest) IsValid ¶
func (ar AccessRequest) IsValid() bool
IsValid checks if the access request is in a valid state for password checkout.
Returns:
- bool: true if password can be checked out.
func (AccessRequest) RefreshState ¶
func (ar AccessRequest) RefreshState() (AccessRequest, error)
RefreshState updates the request with its current state from the server.
Returns:
- AccessRequest: Updated request state
- error: API or unmarshalling errors
func (AccessRequest) SetClient ¶
func (ar AccessRequest) SetClient(c *SafeguardClient) any
type AccessRequestApprovalBatchResponse ¶
type AccessRequestApprovalBatchResponse struct {
Request AccessRequest `json:"Request"`
Status string `json:"Status,omitempty"`
Message string `json:"Message,omitempty"`
Comment string `json:"Comment,omitempty"`
IsEmergency bool `json:"IsEmergency,omitempty"`
}
AccessRequestApprovalBatchResponse represents the response for a batch approval request
type AccessRequestBatchResponse ¶
type AccessRequestBatchResponse struct {
Response AccessRequest `json:"Response,omitempty"`
StatusCode string `json:"StatusCode,omitempty"`
StatusCodeNumber int `json:"StatusCodeNumber,omitempty"`
IsSuccess bool `json:"IsSuccess,omitempty"`
Error ApiError `json:"Error,omitempty"`
Request BatchRequest `json:"Request,omitempty"`
// contains filtered or unexported fields
}
AccessRequestBatchResponse represents the response for a batch access request
func (AccessRequestBatchResponse) SetClient ¶
func (a AccessRequestBatchResponse) SetClient(c *SafeguardClient) any
type AccessRequestDenyBatchResponse ¶
type AccessRequestDenyBatchResponse struct {
Request AccessRequest `json:"Request"`
Status string `json:"Status,omitempty"`
Message string `json:"Message,omitempty"`
Comment string `json:"Comment,omitempty"`
}
AccessRequestDenyBatchResponse represents the response for a batch deny request
type AccessRequestProperties ¶
type AccessRequestProperties struct {
AccessRequestType AccessRequestType `json:"AccessRequestType"`
AllowSimultaneousAccess bool `json:"AllowSimultaneousAccess"`
MaximumSimultaneousReleases int `json:"MaximumSimultaneousReleases"`
ChangePasswordAfterCheckin bool `json:"ChangePasswordAfterCheckin"`
ChangeSshKeyAfterCheckin bool `json:"ChangeSshKeyAfterCheckin"`
AllowSessionPasswordRelease bool `json:"AllowSessionPasswordRelease"`
AllowSessionSshKeyRelease bool `json:"AllowSessionSshKeyRelease"`
IncludePasswordRelease bool `json:"IncludePasswordRelease"`
IncludeSshKeyRelease bool `json:"IncludeSshKeyRelease"`
SessionAccessAccountType SessionAccessAccountType `json:"SessionAccessAccountType"`
SessionAccessAccounts []int `json:"SessionAccessAccounts"`
TerminateExpiredSessions bool `json:"TerminateExpiredSessions"`
AllowLinkedAccountPasswordAccess bool `json:"AllowLinkedAccountPasswordAccess"`
PassphraseProtectSshKey bool `json:"PassphraseProtectSshKey"`
UseAltLoginName bool `json:"UseAltLoginName"`
LinkedAccountScopeFiltering bool `json:"LinkedAccountScopeFiltering"`
}
AccessRequestProperties represents configuration governing access requests
type AccessRequestReviewBatchResponse ¶
type AccessRequestReviewBatchResponse struct {
Request AccessRequest `json:"Request"`
Status string `json:"Status,omitempty"`
Message string `json:"Message,omitempty"`
Comment string `json:"Comment,omitempty"`
}
AccessRequestReviewBatchResponse represents the response for a batch review request
type AccessRequestRole ¶
type AccessRequestRole string
AccessRequestRole represents the role of a user in an access request
const ( RequestorRole AccessRequestRole = "Requestor" ApproverRole AccessRequestRole = "Approver" ReviewerRole AccessRequestRole = "Reviewer" AdminRole AccessRequestRole = "Admin" WatcherRole AccessRequestRole = "Watcher" MonitorRole AccessRequestRole = "Monitor" )
type AccessRequestSession ¶
type AccessRequestSession struct {
Id string `json:"Id,omitempty"`
AccessRequestId string `json:"AccessRequestId,omitempty"`
ApiVersion string `json:"ApiVersion,omitempty"`
LaunchedByUserId int `json:"LaunchedByUserId,omitempty"`
LaunchedByUserDisplayName string `json:"LaunchedByUserDisplayName,omitempty"`
SessionStarted time.Time `json:"SessionStarted,omitempty"`
SessionEnd *time.Time `json:"SessionEnd,omitempty"`
ApplianceId string `json:"ApplianceId,omitempty"`
ApplianceName string `json:"ApplianceName,omitempty"`
ApplianceAddress string `json:"ApplianceAddress,omitempty"`
SessionKey string `json:"SessionKey,omitempty"`
PSMKey string `json:"PSMKey,omitempty"`
AccountName string `json:"AccountName,omitempty"`
AccountDomainName string `json:"AccountDomainName,omitempty"`
AssetName string `json:"AssetName,omitempty"`
NodeName string `json:"NodeName,omitempty"`
IsPlaybackAvailable bool `json:"IsPlaybackAvailable,omitempty"`
IsTerminated bool `json:"IsTerminated,omitempty"`
TerminatedByUserId *int `json:"TerminatedByUserId,omitempty"`
TerminatedByUserName *string `json:"TerminatedByUserName,omitempty"`
ErrorMessage *string `json:"ErrorMessage,omitempty"`
SessionId int `json:"SessionId,omitempty"`
InitializedDate time.Time `json:"InitializedDate,omitempty"`
ConnectedDate time.Time `json:"ConnectedDate,omitempty"`
TerminatedDate time.Time `json:"TerminatedDate,omitempty"`
State string `json:"State,omitempty"`
HasRecording bool `json:"HasRecording,omitempty"`
}
AccessRequestSession represents information about sessions initialized using this request
type AccessRequestState ¶
type AccessRequestState string
AccessRequestState represents possible states of an access request
const ( StateNew AccessRequestState = "New" StatePendingApproval AccessRequestState = "PendingApproval" StatePendingTimeRequested AccessRequestState = "PendingTimeRequested" StatePendingAccountRestored AccessRequestState = "PendingAccountRestored" StatePendingAccountElevated AccessRequestState = "PendingAccountElevated" StateRequestAvailable AccessRequestState = "RequestAvailable" StatePasswordCheckedOut AccessRequestState = "PasswordCheckedOut" StatePasswordCheckedIn AccessRequestState = "PasswordCheckedIn" StatePendingReview AccessRequestState = "PendingReview" StatePendingPasswordReset AccessRequestState = "PendingPasswordReset" StateExpired AccessRequestState = "Expired" StateDenied AccessRequestState = "Denied" StateCanceled AccessRequestState = "Canceled" StateRevoked AccessRequestState = "Revoked" StatePendingAcknowledgment AccessRequestState = "PendingAcknowledgment" StateAcknowledged AccessRequestState = "Acknowledged" StateCompleted AccessRequestState = "Complete" StatePending AccessRequestState = "Pending" )
type AccessRequestType ¶
type AccessRequestType string
AccessRequestType represents the type of access request
const ( AccessRequestTypePassword AccessRequestType = "Password" AccessRequestTypeRDPFile AccessRequestType = "RemoteDesktop" AccessRequestTypeSSHFile AccessRequestType = "SSH" AccessRequestTypeSSHKey AccessRequestType = "SSHKey" AccessRequestTypeAPIKey AccessRequestType = "APIKey" AccessRequestTypeRDP AccessRequestType = "RemoteDesktop" AccessRequestTypeTelnet AccessRequestType = "Telnet" AccessRequestTypeRDPApplication AccessRequestType = "RemoteDesktopApplication" AccessRequestTypeFile AccessRequestType = "File" )
func (AccessRequestType) String ¶
func (a AccessRequestType) String() string
String returns the string representation of the AccessRequestType
type AccountEntitlement ¶
type AccountEntitlement struct {
Account AccountInfo `json:"Account,omitempty"`
Asset AssetInfo `json:"Asset,omitempty"`
Policies []PolicyInfo `json:"Policies,omitempty"`
ActiveRequests []ActiveRequestInfo `json:"ActiveRequests,omitempty"`
// contains filtered or unexported fields
}
AccountEntitlement represents the full account entitlement structure
func (AccountEntitlement) GetAccessRequestType ¶
func (m AccountEntitlement) GetAccessRequestType() AccessRequestType
GetAccessRequestType returns the access request type from the first policy If no policies exist, returns an empty string
func (AccountEntitlement) GetAccountId ¶
func (m AccountEntitlement) GetAccountId() int
GetAccountId returns the ID of the account associated with this entitlement
func (AccountEntitlement) GetFilter ¶
func (m AccountEntitlement) GetFilter() Filter
GetFilter returns a filter object configured with the account ID
func (AccountEntitlement) SetClient ¶
func (a AccountEntitlement) SetClient(c *SafeguardClient) any
type AccountInfo ¶
type AccountInfo struct {
Id int `json:"Id,omitempty"`
Name string `json:"Name,omitempty"`
DomainName string `json:"DomainName,omitempty"`
Description *string `json:"Description,omitempty"`
HasPassword bool `json:"HasPassword,omitempty"`
HasSshKey bool `json:"HasSshKey,omitempty"`
HasApiKey bool `json:"HasApiKey,omitempty"`
HasFile bool `json:"HasFile,omitempty"`
Disabled bool `json:"Disabled,omitempty"`
AssetId int `json:"AssetId,omitempty"`
AssetName string `json:"AssetName,omitempty"`
AssetNetworkAddress *string `json:"AssetNetworkAddress,omitempty"`
AllowPasswordRequest bool `json:"AllowPasswordRequest,omitempty"`
AllowSessionRequest bool `json:"AllowSessionRequest,omitempty"`
AllowSshKeyRequest bool `json:"AllowSshKeyRequest,omitempty"`
AllowApiKeyRequest bool `json:"AllowApiKeyRequest,omitempty"`
AllowFileRequest bool `json:"AllowFileRequest,omitempty"`
Tags []string `json:"Tags,omitempty"`
}
AccountInfo represents account information in entitlement response
type AccountPasswordRule ¶
type AccountPasswordRule struct {
Id int `json:"Id"`
IsSystemOwned bool `json:"IsSystemOwned"`
AssetPartitionId int `json:"AssetPartitionId"`
AssetPartitionName string `json:"AssetPartitionName"`
CreatedDate time.Time `json:"CreatedDate"`
CreatedByUserId int `json:"CreatedByUserId"`
CreatedByUserDisplayName string `json:"CreatedByUserDisplayName"`
Name string `json:"Name"`
Description string `json:"Description"`
MaxCharacters int `json:"MaxCharacters"`
MinCharacters int `json:"MinCharacters"`
AllowUppercaseCharacters bool `json:"AllowUppercaseCharacters"`
MinUppercaseCharacters int `json:"MinUppercaseCharacters"`
InvalidUppercaseCharacters []string `json:"InvalidUppercaseCharacters"`
MaxConsecutiveUppercaseCharacters int `json:"MaxConsecutiveUppercaseCharacters"`
AllowLowercaseCharacters bool `json:"AllowLowercaseCharacters"`
MinLowercaseCharacters int `json:"MinLowercaseCharacters"`
InvalidLowercaseCharacters []string `json:"InvalidLowercaseCharacters"`
MaxConsecutiveLowercaseCharacters int `json:"MaxConsecutiveLowercaseCharacters"`
AllowNumericCharacters bool `json:"AllowNumericCharacters"`
MinNumericCharacters int `json:"MinNumericCharacters"`
InvalidNumericCharacters []string `json:"InvalidNumericCharacters"`
MaxConsecutiveNumericCharacters int `json:"MaxConsecutiveNumericCharacters"`
AllowNonAlphaNumericCharacters bool `json:"AllowNonAlphaNumericCharacters"`
MinNonAlphaNumericCharacters int `json:"MinNonAlphaNumericCharacters"`
NonAlphaNumericRestrictionType string `json:"NonAlphaNumericRestrictionType"`
AllowedNonAlphaNumericCharacters []string `json:"AllowedNonAlphaNumericCharacters"`
InvalidNonAlphaNumericCharacters []string `json:"InvalidNonAlphaNumericCharacters"`
MaxConsecutiveNonAlphaNumericCharacters int `json:"MaxConsecutiveNonAlphaNumericCharacters"`
AllowedFirstCharacterType string `json:"AllowedFirstCharacterType"`
AllowedLastCharacterType string `json:"AllowedLastCharacterType"`
MaxConsecutiveAlphabeticCharacters int `json:"MaxConsecutiveAlphabeticCharacters"`
MaxConsecutiveAlphaNumericCharacters int `json:"MaxConsecutiveAlphaNumericCharacters"`
RepeatedCharacterRestriction string `json:"RepeatedCharacterRestriction"`
// contains filtered or unexported fields
}
AccountPasswordRule defines the requirements and constraints for generating and validating account passwords within an asset partition. It specifies character requirements, restrictions, and other password complexity rules.
func (AccountPasswordRule) Assign ¶
func (r AccountPasswordRule) Assign(assetAccount AssetAccount) (AssetAccount, error)
Assign associates this password rule with the specified asset account. This operation updates the asset account's password profile with the current rule.
Parameters:
- assetAccount: The asset account to modify
Returns:
- (AssetAccount): The updated asset account
- (error): An error if the assignment fails
func (AccountPasswordRule) SetClient ¶
func (a AccountPasswordRule) SetClient(c *SafeguardClient) any
func (AccountPasswordRule) ToJson ¶
func (r AccountPasswordRule) ToJson() (string, error)
ToJson serializes the AccountPasswordRule instance into a JSON string representation.
Returns:
- (string): JSON representation of the password rule
- (error): An error if JSON marshaling fails
type AccountTaskData ¶
type AccountTaskData struct {
Id int `json:"Id"`
Name string `json:"Name"`
DistinguishedName string `json:"DistinguishedName"`
DomainName string `json:"DomainName"`
Description string `json:"Description"`
Disabled bool `json:"Disabled"`
Asset Asset `json:"Asset"`
Platform Platform `json:"Platform"`
Schedule Schedule `json:"Schedule"`
TaskProperties TaskProperties `json:"TaskProperties"`
AssetName string `json:"assetName,omitempty"`
AccountName string `json:"accountName,omitempty"`
AccountDomainName string `json:"accountDomainName,omitempty"`
AccountDistinguishedName string `json:"accountDistinguishedName,omitempty"`
TaskName TaskNames `json:"taskName"`
Status string `json:"status,omitempty"`
LastExecuted string `json:"lastExecuted,omitempty"`
NextScheduled string `json:"nextScheduled,omitempty"`
ErrorMessage string `json:"errorMessage,omitempty"`
// contains filtered or unexported fields
}
AccountTaskData represents platform task information for an asset or directory account
func (AccountTaskData) SetClient ¶
func (a AccountTaskData) SetClient(c *SafeguardClient) any
func (AccountTaskData) ToJson ¶
func (a AccountTaskData) ToJson() (string, error)
ToJson serializes an AccountTaskData object into a JSON string.
Parameters:
- none
Returns:
- string: A JSON representation of the AccountTaskData object
- error: An error if JSON marshaling fails, nil otherwise
type ActionableAccessRequests ¶
type ActionableAccessRequests struct {
Count int `json:"Count,omitempty"`
AccessRequests []AccessRequest `json:"AccessRequests,omitempty"`
RequestsToReview []AccessRequest `json:"RequestsToReview,omitempty"`
RequestRole AccessRequestRole `json:"RequestRole,omitempty"`
}
ActionableAccessRequests represents asset requests that the current user can perform some action on
type ActionableRequestsResult ¶
type ActionableRequestsResult struct {
AllRequests []AccessRequest
RequestsByRole map[AccessRequestRole][]AccessRequest
TotalCount int
CountByRole map[AccessRequestRole]int
AvailableRoles []AccessRequestRole
// contains filtered or unexported fields
}
ActionableRequestsResult represents the processed result of GetMeActionableRequests
func (*ActionableRequestsResult) FilterRequestsByState ¶
func (r *ActionableRequestsResult) FilterRequestsByState(state AccessRequestState) []AccessRequest
FilterRequestsByState returns all requests matching the specified state.
Parameters:
- state: The AccessRequestState to filter by
Returns:
- []AccessRequest: A slice of access requests in the specified state
func (*ActionableRequestsResult) GetPendingRequests ¶
func (r *ActionableRequestsResult) GetPendingRequests() []AccessRequest
GetPendingRequests returns all requests that require action. This includes requests in New, PendingApproval, and PendingReview states.
Returns:
- []AccessRequest: A slice of pending access requests
func (*ActionableRequestsResult) GetRequestsForRole ¶
func (r *ActionableRequestsResult) GetRequestsForRole(role AccessRequestRole) []AccessRequest
GetRequestsForRole returns all requests for a specific role.
Parameters:
- role: The AccessRequestRole to get requests for
Returns:
- []AccessRequest: A slice of access requests for the specified role
func (*ActionableRequestsResult) HasRole ¶
func (r *ActionableRequestsResult) HasRole(role AccessRequestRole) bool
HasRole checks if there are any requests for the specified role.
Parameters:
- role: The AccessRequestRole to check for
Returns:
- bool: true if there are requests for the role, false otherwise
func (ActionableRequestsResult) SetClient ¶
func (a ActionableRequestsResult) SetClient(c *SafeguardClient) any
type ActiveRequestInfo ¶
type ActiveRequestInfo struct {
Id string `json:"Id,omitempty"`
AccessRequestType AccessRequestType `json:"AccessRequestType,omitempty"`
State AccessRequestState `json:"State,omitempty"`
ExpiresOn time.Time `json:"ExpiresOn,omitempty"`
CreatedOn time.Time `json:"CreatedOn,omitempty"`
}
ActiveRequestInfo represents information about an active request
type ActivityLog ¶
type ActivityLog struct {
Id string `json:"Id"`
LogTime time.Time `json:"LogTime"`
UserId int `json:"UserId"`
UserProperties UserLogProperties `json:"UserProperties"`
ApplianceId string `json:"ApplianceId"`
ApplianceName string `json:"ApplianceName"`
EventName string `json:"EventName"`
EventDisplayName string `json:"EventDisplayName"`
Name string `json:"Name"`
AssetId int `json:"AssetId"`
AssetName string `json:"AssetName"`
AccountId int `json:"AccountId"`
AccountName string `json:"AccountName"`
AccountDomainName string `json:"AccountDomainName"`
NetworkAddress string `json:"NetworkAddress"`
RequestStatus RequestStatus `json:"RequestStatus"`
Log []LogEntry `json:"Log"`
ConnectionProps ConnectionProperties `json:"ConnectionProperties"`
CustomParams []CustomScriptParameter `json:"CustomScriptParameters"`
// contains filtered or unexported fields
}
ActivityLog represents a comprehensive log entry for password-related activities including user actions, asset details, and request status
func (*ActivityLog) CheckTaskState ¶
func (p *ActivityLog) CheckTaskState(ctx context.Context) (bool, error)
CheckTaskState monitors the state of a password activity task. It polls the task status periodically until completion or timeout.
Example:
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() success, err := passwordLog.CheckTaskState(ctx)
Parameters:
- ctx: Context for timeout and cancellation control. Should include a reasonable timeout.
Returns:
- bool: true if task completed successfully, false if task failed or was cancelled
- error: Error if monitoring fails, times out, or context is cancelled
func (ActivityLog) SetClient ¶
func (a ActivityLog) SetClient(c *SafeguardClient) any
type ApiError ¶
type ApiError struct {
Code int `json:"Code,omitempty"`
Message string `json:"Message,omitempty"`
InnerError string `json:"InnerError,omitempty"`
}
ApiError represents error information returned by the API
type ApiSetOperation ¶
type ApiSetOperation string
ApiSetOperation represents the type of operation that can be performed on ApproverSets
const ( // Add represents the operation to add approver sets Add ApiSetOperation = "Add" // Remove represents the operation to remove approver sets Remove ApiSetOperation = "Remove" )
type ApproverProperties ¶
type ApproverProperties struct {
RequireApproval bool `json:"RequireApproval"`
PendingApprovalEscalationEnabled bool `json:"PendingApprovalEscalationEnabled"`
PendingApprovalDurationBeforeEscalationDays int `json:"PendingApprovalDurationBeforeEscalationDays"`
PendingApprovalDurationBeforeEscalationHours int `json:"PendingApprovalDurationBeforeEscalationHours"`
PendingApprovalDurationBeforeEscalationMinutes int `json:"PendingApprovalDurationBeforeEscalationMinutes"`
}
ApproverProperties represents settings related to approving access requests
type ApproverSet ¶
type ApproverSet struct {
RequiredApprovers int `json:"RequiredApprovers"`
Approvers []Identity `json:"Approvers"`
}
ApproverSet represents a set of identities required to approve an access request
type Asset ¶
type Asset struct {
Id int `json:"Id,omitempty"`
Name string `json:"Name,omitempty"`
NetworkAddress string `json:"NetworkAddress,omitempty"`
Description string `json:"Description,omitempty"`
PlatformId int `json:"PlatformId,omitempty"`
PlatformDisplayName string `json:"PlatformDisplayName,omitempty"`
AssetPartitionId int `json:"AssetPartitionId,omitempty"`
AssetPartitionName string `json:"AssetPartitionName,omitempty"`
LicenseClass string `json:"LicenseClass,omitempty"`
IsDirectory bool `json:"IsDirectory,omitempty"`
ManagedNetworkId int `json:"ManagedNetworkId,omitempty"`
ManagedNetworkName string `json:"ManagedNetworkName,omitempty"`
CreatedDate time.Time `json:"CreatedDate,omitempty"`
CreatedByUserId int `json:"CreatedByUserId,omitempty"`
CreatedByUserDisplayName string `json:"CreatedByUserDisplayName,omitempty"`
Platform Platform `json:"Platform,omitempty"`
Tags []Tag `json:"Tags,omitempty"`
ManagedBy []Identity `json:"ManagedBy,omitempty"`
DiscoveredGroups []DiscoveredGroup `json:"DiscoveredGroups,omitempty"`
TaskProperties AssetTaskProperties `json:"TaskProperties,omitempty"`
ConnectionProperties AssetConnectionProperties `json:"ConnectionProperties,omitempty"`
SessionAccessProperties AssetSessionAccessProperties `json:"SessionAccessProperties,omitempty"`
SshHostKey AssetSshHostKey `json:"SshHostKey,omitempty"`
Disabled bool `json:"Disabled,omitempty"`
AssetType AssetType `json:"AssetType,omitempty"`
DirectoryProperties DirectoryProperties `json:"DirectoryProperties,omitempty"`
DirectoryAssetProperties DirectoryAssetProperties `json:"DirectoryAssetProperties,omitempty"`
StarlingAssetProperties StarlingAssetProperties `json:"StarlingAssetProperties,omitempty"`
AssetDiscoveryJobId int `json:"AssetDiscoveryJobId,omitempty"`
AssetDiscoveryJobName string `json:"AssetDiscoveryJobName,omitempty"`
AccountDiscoveryScheduleId int `json:"AccountDiscoveryScheduleId,omitempty"`
AccountDiscoveryScheduleName string `json:"AccountDiscoveryScheduleName,omitempty"`
DependentSystemIds []int `json:"DependentSystemIds,omitempty"`
CustomScriptParameters []CustomScriptParameter `json:"CustomScriptParameters,omitempty"`
PasswordProfile Profile `json:"PasswordProfile,omitempty"`
SshKeyProfile Profile `json:"SshKeyProfile,omitempty"`
RegisteredConnector RegisteredConnector `json:"RegisteredConnector,omitempty"`
// contains filtered or unexported fields
}
Asset represents a Safeguard asset
func (Asset) Delete ¶
Delete removes the asset identified by its ID from the system. It constructs a query string using the asset's ID and sends a DELETE request to the API client. If the request fails, it returns an error; otherwise, it returns nil.
func (Asset) GetAccounts ¶
func (a Asset) GetAccounts(filter Filter) ([]AssetAccount, error)
GetAccounts retrieves a list of accounts associated with the asset. It accepts a Filter parameter to apply filtering on the accounts. The function returns a slice of AssetAccount and an error if any occurs during the process.
Parameters:
- filter: A Filter object containing fields to filter the accounts.
Returns:
- []AssetAccount: A slice of AssetAccount objects.
- error: An error object if an error occurs, otherwise nil.
func (Asset) GetDirectoryAccounts ¶
func (a Asset) GetDirectoryAccounts(filter Filter) ([]AssetAccount, error)
GetDirectoryAccounts retrieves all directory accounts associated with this asset.
Parameters:
- filter: Query parameters to filter the results
Returns:
- ([]AssetAccount): Slice of matching directory accounts
- (error): An error if the API request fails
func (Asset) GetDirectoryAssets ¶
GetDirectoryAssets retrieves all directory assets associated with this asset.
Parameters:
- filter: Query parameters to filter the results
Returns:
- ([]Asset): Slice of matching directory assets
- (error): An error if the API request fails
func (Asset) GetDirectoryServiceEntries ¶
func (a Asset) GetDirectoryServiceEntries(filter Filter) ([]DirectoryServiceEntry, error)
GetDirectoryServiceEntries retrieves all directory service entries associated with this asset.
Parameters:
- filter: Query parameters to filter the results
Returns:
- ([]DirectoryServiceEntry): Slice of matching directory service entries
- (error): An error if the API request fails
func (Asset) SetClient ¶
func (a Asset) SetClient(c *SafeguardClient) any
func (Asset) ToJson ¶
ToJson serializes the Asset instance into a JSON string representation.
Returns:
- (string): JSON representation of the asset
- (error): An error if JSON marshaling fails
type AssetAccount ¶
type AssetAccount struct {
Id int `json:"Id,omitempty"`
Name string `json:"Name,omitempty"`
DistinguishedName string `json:"DistinguishedName,omitempty"`
DomainName string `json:"DomainName,omitempty"`
AccountNamespace string `json:"AccountNamespace,omitempty"`
Description string `json:"Description,omitempty"`
AltLoginName string `json:"AltLoginName,omitempty"`
PrivilegeGroupMembershipList []string `json:"PrivilegeGroupMembershipList,omitempty"`
CreatedDate string `json:"CreatedDate,omitempty"`
CreatedByUserId int `json:"CreatedByUserId,omitempty"`
CreatedByUserDisplayName string `json:"CreatedByUserDisplayName,omitempty"`
ManagedBy []Identity `json:"ManagedBy,omitempty"`
Disabled bool `json:"Disabled,omitempty"`
IsServiceAccount bool `json:"IsServiceAccount,omitempty"`
IsApplicationAccount bool `json:"IsApplicationAccount,omitempty"`
Tags []Tag `json:"Tags,omitempty"`
Asset Asset `json:"Asset,omitempty"`
PasswordProfile Profile `json:"PasswordProfile,omitempty"`
SshKeyProfile Profile `json:"SshKeyProfile,omitempty"`
RequestProperties RequestProperties `json:"RequestProperties,omitempty"`
Platform Platform `json:"Platform,omitempty"`
DiscoveredProperties DiscoveredProperties `json:"DiscoveredProperties,omitempty"`
DirectoryProperties DirectoryProperties `json:"DirectoryProperties,omitempty"`
SyncGroup SyncGroup `json:"SyncGroup,omitempty"`
SshKeySyncGroup SyncGroup `json:"SshKeySyncGroup,omitempty"`
HasPassword bool `json:"HasPassword,omitempty"`
HasSshKey bool `json:"HasSshKey,omitempty"`
HasTotpAuthenticator bool `json:"HasTotpAuthenticator,omitempty"`
HasApiKeys bool `json:"HasApiKeys,omitempty"`
HasFile bool `json:"HasFile,omitempty"`
TaskProperties TaskProperties `json:"TaskProperties,omitempty"`
// contains filtered or unexported fields
}
AssetAccount represents a privileged account managed by Safeguard, containing its configuration, credentials and relationships.
func (AssetAccount) ChangePassword ¶
func (a AssetAccount) ChangePassword() (ActivityLog, error)
ChangePassword initiates a password change operation for the asset account. Parameters:
- c: The SafeguardClient instance for making API requests
Returns:
- PasswordActivityLog: Log details of the password change activity
- error: An error if the password change fails or cannot be initiated
func (AssetAccount) CheckPassword ¶
func (a AssetAccount) CheckPassword() (ActivityLog, error)
CheckPassword verifies if the current password for the asset account is valid. Parameters:
- c: The SafeguardClient instance for making API requests
Returns:
- PasswordActivityLog: Log details of the password check activity
- error: An error if the password check fails or cannot be initiated
func (AssetAccount) Create ¶
func (a AssetAccount) Create() (AssetAccount, error)
Create adds this account to Safeguard. Required fields must be populated before calling.
Returns:
- AssetAccount: Created account with server-assigned fields
- error: Creation errors
func (AssetAccount) Delete ¶
func (a AssetAccount) Delete() error
Delete permanently removes the account.
Returns:
- error: Deletion errors
func (AssetAccount) Disable ¶
func (a AssetAccount) Disable() (AssetAccount, error)
Disable deactivates the account for password management.
Returns:
- AssetAccount: Updated account showing disabled
- error: Disable operation errors
func (AssetAccount) Enable ¶
func (a AssetAccount) Enable() (AssetAccount, error)
Enable activates the account for password management.
Returns:
- AssetAccount: Updated account showing enabled
- error: Enable operation errors
func (AssetAccount) SetClient ¶
func (a AssetAccount) SetClient(c *SafeguardClient) any
func (AssetAccount) Suspend ¶
func (a AssetAccount) Suspend() (ActivityLog, error)
Suspend temporarily disables the account on target system.
Returns:
- PasswordActivityLog: Suspension details
- error: Suspend operation errors
func (AssetAccount) ToJson ¶
func (a AssetAccount) ToJson() (string, error)
ToJson serializes an AssetAccount object into its JSON string representation. Returns the JSON string and any error that occurred during marshalling.
func (AssetAccount) Update ¶
func (a AssetAccount) Update() (AssetAccount, error)
Update modifies the account in Safeguard. Only modifiable fields are updated.
Returns:
- AssetAccount: Updated account state
- error: Update errors
func (AssetAccount) UpdatePasswordProfile ¶
func (a AssetAccount) UpdatePasswordProfile(passwordPolicy AccountPasswordRule) (AssetAccount, error)
UpdatePasswordProfile updates the password profile for this asset account. It uses the UpdatePasswordProfile function with the current client. Parameters:
- passwordPolicy: The AccountPasswordRule to apply to this account
Returns:
- AssetAccount: The updated asset account with the new password profile
- error: An error if the update fails, nil otherwise
type AssetAccountBatchResponse ¶
type AssetAccountBatchResponse struct {
Response AssetAccount `json:"Response,omitempty"`
StatusCode string `json:"StatusCode,omitempty"`
StatusCodeNumber int `json:"StatusCodeNumber,omitempty"`
IsSuccess bool `json:"IsSuccess,omitempty"`
Error ApiError `json:"Error,omitempty"`
Request AssetAccount `json:"Request,omitempty"`
// contains filtered or unexported fields
}
AssetAccountBatchResponse represents a single item in the batch response array
func (AssetAccountBatchResponse) SetClient ¶
func (a AssetAccountBatchResponse) SetClient(c *SafeguardClient) any
type AssetConnectionProperties ¶
type AssetConnectionProperties struct {
ServiceAccountId int `json:"ServiceAccountId,omitempty"`
ServiceAccountName string `json:"ServiceAccountName,omitempty"`
EffectiveServiceAccountName string `json:"EffectiveServiceAccountName,omitempty"`
ServiceAccountDomainName string `json:"ServiceAccountDomainName,omitempty"`
ServiceAccountDistinguishedName string `json:"ServiceAccountDistinguishedName,omitempty"`
EffectiveServiceAccountDistinguishedName string `json:"EffectiveServiceAccountDistinguishedName,omitempty"`
ServiceAccountCredentialType ServiceAccountCredentialType `json:"ServiceAccountCredentialType,omitempty"`
ServiceAccountPassword string `json:"ServiceAccountPassword,omitempty"`
ServiceAccountHasPassword bool `json:"ServiceAccountHasPassword,omitempty"`
ServiceAccountSshKey SshKey `json:"ServiceAccountSshKey,omitempty"`
ServiceAccountHasSshKey bool `json:"ServiceAccountHasSshKey,omitempty"`
ServiceAccountApiKey string `json:"ServiceAccountApiKey,omitempty"`
ServiceAccountHasApiKey bool `json:"ServiceAccountHasApiKey,omitempty"`
Port int `json:"Port,omitempty"`
ServiceAccountAssetId int `json:"ServiceAccountAssetId,omitempty"`
ServiceAccountAssetName string `json:"ServiceAccountAssetName,omitempty"`
ServiceAccountAssetPlatformId int `json:"ServiceAccountAssetPlatformId,omitempty"`
ServiceAccountAssetPlatformType string `json:"ServiceAccountAssetPlatformType,omitempty"`
ServiceAccountAssetPlatformDisplayName string `json:"ServiceAccountAssetPlatformDisplayName,omitempty"`
ServiceAccountNetbiosName string `json:"ServiceAccountNetbiosName,omitempty"`
ServiceAccountUniqueObjectId string `json:"ServiceAccountUniqueObjectId,omitempty"`
ServiceAccountSecurityId string `json:"ServiceAccountSecurityId,omitempty"`
ServiceAccountProfileId int `json:"ServiceAccountProfileId,omitempty"`
ServiceAccountProfileName string `json:"ServiceAccountProfileName,omitempty"`
ServiceAccountSshKeyProfileId int `json:"ServiceAccountSshKeyProfileId,omitempty"`
ServiceAccountSshKeyProfileName string `json:"ServiceAccountSshKeyProfileName,omitempty"`
EnablePassword string `json:"EnablePassword,omitempty"`
EnableHasPassword bool `json:"EnableHasPassword,omitempty"`
CommandTimeout int `json:"CommandTimeout,omitempty"`
WorkstationId string `json:"WorkstationId,omitempty"`
ClientId int `json:"ClientId,omitempty"`
UseSslEncryption bool `json:"UseSslEncryption,omitempty"`
VerifySslCertificate bool `json:"VerifySslCertificate,omitempty"`
Instance string `json:"Instance,omitempty"`
ServiceName string `json:"ServiceName,omitempty"`
SslThumbprint string `json:"SslThumbprint,omitempty"`
PrivilegeElevationCommand string `json:"PrivilegeElevationCommand,omitempty"`
AccessKeyId string `json:"AccessKeyId,omitempty"`
SecretKey string `json:"SecretKey,omitempty"`
HasSecretKey bool `json:"HasSecretKey,omitempty"`
OraclePrivileges string `json:"OraclePrivileges,omitempty"`
HideAlterUserCommand bool `json:"HideAlterUserCommand,omitempty"`
UseServiceAccountUserNameOnly bool `json:"UseServiceAccountUserNameOnly,omitempty"`
UseNamedPipeForServiceAccountConnection bool `json:"UseNamedPipeForServiceAccountConnection,omitempty"`
RegisteredConnectorId int `json:"RegisteredConnectorId,omitempty"`
TacacsSecret string `json:"TacacsSecret,omitempty"`
HasTacacsSecret bool `json:"HasTacacsSecret,omitempty"`
UseTopSecretInterval bool `json:"UseTopSecretInterval,omitempty"`
UseHttpProxy bool `json:"UseHttpProxy,omitempty"`
AlternateConnectionProperties map[string]string `json:"AlternateConnectionProperties,omitempty"`
}
AssetConnectionProperties represents connection settings for an asset
type AssetDirectoryProperties ¶
type AssetDirectoryProperties struct {
NetbiosName string `json:"NetbiosName,omitempty"`
ObjectGuid string `json:"ObjectGuid,omitempty"`
ObjectSid string `json:"ObjectSid,omitempty"`
}
AssetDirectoryProperties represents directory properties of an asset
type AssetGroup ¶
type AssetGroup struct {
Id int `json:"Id"`
Name string `json:"Name"`
Description string `json:"Description"`
IsDynamic bool `json:"IsDynamic"`
Assets []PolicyAsset `json:"Assets"`
AssetGroupingRule AssetGroupingRule `json:"AssetGroupingRule"`
CreatedDate time.Time `json:"CreatedDate"`
CreatedByUserId int `json:"CreatedByUserId"`
CreatedByUserDisplayName string `json:"CreatedByUserDisplayName"`
// contains filtered or unexported fields
}
AssetGroup represents a group of assets on the appliance for use in session policy. Only assets that support session access are allowed.
func (AssetGroup) Delete ¶
func (a AssetGroup) Delete() error
Delete removes this asset group from the system.
Returns:
- (error): An error if the deletion fails
func (AssetGroup) SetClient ¶
func (a AssetGroup) SetClient(c *SafeguardClient) any
func (AssetGroup) ToJson ¶
func (a AssetGroup) ToJson() (string, error)
ToJson serializes the AssetGroup instance into a JSON string representation.
Returns:
- (string): JSON representation of the asset group
- (error): An error if JSON marshaling fails
func (AssetGroup) Update ¶
func (a AssetGroup) Update() (AssetGroup, error)
Update persists any changes made to this AssetGroup instance.
Returns:
- (AssetGroup): The updated asset group
- (error): An error if the update fails
type AssetGroupingRule ¶
type AssetGroupingRule struct {
Description string `json:"Description"`
Enabled bool `json:"Enabled"`
RuleConditionGroup RuleConditionGroup `json:"RuleConditionGroup"`
}
AssetGroupingRule represents rules for automatically grouping assets
type AssetInfo ¶
type AssetInfo struct {
Id int `json:"Id,omitempty"`
Name string `json:"Name,omitempty"`
DomainName *string `json:"DomainName,omitempty"`
Description *string `json:"Description,omitempty"`
NetworkAddress *string `json:"NetworkAddress,omitempty"`
PlatformDisplayName string `json:"PlatformDisplayName,omitempty"`
PlatformType string `json:"PlatformType,omitempty"`
Tags []string `json:"Tags,omitempty"`
}
AssetInfo represents asset information in entitlement response
type AssetPartition ¶
type AssetPartition struct {
Id int `json:"Id"`
Name string `json:"Name"`
Description string `json:"Description"`
CreatedDate time.Time `json:"CreatedDate"`
CreatedByUserId int `json:"CreatedByUserId"`
CreatedByUserDisplayName string `json:"CreatedByUserDisplayName"`
ManagedBy []Identity `json:"ManagedBy"`
DefaultProfileId int `json:"DefaultProfileId"`
DefaultProfileName string `json:"DefaultProfileName"`
DefaultSshKeyProfileId int `json:"DefaultSshKeyProfileId"`
DefaultSshKeyProfileName string `json:"DefaultSshKeyProfileName"`
// contains filtered or unexported fields
}
AssetPartition represents a collection of assets and accounts along with management configuration. The partition defines boundaries for asset management and access control within Safeguard.
func (AssetPartition) Delete ¶
func (a AssetPartition) Delete() error
Delete removes this asset partition from the system.
Returns:
- (error): An error if the deletion fails
func (AssetPartition) GetPasswordRules ¶
func (a AssetPartition) GetPasswordRules() ([]AccountPasswordRule, error)
GetPasswordRules retrieves all password rules associated with this asset partition.
Returns:
- ([]AccountPasswordRule): Slice of password rules for this partition
- (error): An error if the API request fails
func (AssetPartition) SetClient ¶
func (a AssetPartition) SetClient(c *SafeguardClient) any
func (AssetPartition) ToJson ¶
func (u AssetPartition) ToJson() (string, error)
ToJson serializes the AssetPartition instance into a JSON string representation.
Returns:
- (string): JSON representation of the asset partition
- (error): An error if JSON marshaling fails
type AssetPolicy ¶
type AssetPolicy struct {
PolicyId int `json:"PolicyId"`
PolicyName string `json:"PolicyName"`
AccessRequestType AccessRequestType `json:"AccessRequestType"`
RoleId int `json:"RoleId"`
RoleName string `json:"RoleName"`
AssetId int `json:"AssetId"`
AssetName string `json:"AssetName"`
PolicyAccountCount int `json:"PolicyAccountCount"`
PolicyAccountGroupCount int `json:"PolicyAccountGroupCount"`
PolicyAssetCount int `json:"PolicyAssetCount"`
PolicyAssetGroupCount int `json:"PolicyAssetGroupCount"`
Membership []AssetPolicyMembership `json:"Membership"`
// contains filtered or unexported fields
}
AssetPolicy represents a policy that an asset belongs to plus how that membership was granted
func (AssetPolicy) SetClient ¶
func (a AssetPolicy) SetClient(c *SafeguardClient) any
func (AssetPolicy) ToJson ¶
func (a AssetPolicy) ToJson() (string, error)
ToJson serializes an AssetPolicy object into a JSON string.
This method converts the AssetPolicy instance into a JSON-formatted string, including all defined fields. Empty or zero-valued fields are included in the output.
Example:
policy := AssetPolicy{
PolicyName: "Linux Servers",
AccessRequestType: AccessRequestTypeSSH
}
json, err := policy.ToJson()
Parameters:
- none
Returns:
- string: A JSON representation of the AssetPolicy object
- error: An error if JSON marshaling fails, nil otherwise
type AssetPolicyMembership ¶
type AssetPolicyMembership struct {
PolicyId int `json:"PolicyId"`
AssetId int `json:"AssetId"`
PolicyMemberId int `json:"PolicyMemberId"`
PolicyMemberName string `json:"PolicyMemberName"`
PolicyMemberIsAssetGroup bool `json:"PolicyMemberIsAssetGroup"`
PolicyMemberIsAccountGroup bool `json:"PolicyMemberIsAccountGroup"`
}
AssetPolicyMembership represents details about how an asset is assigned to a policy
type AssetSessionAccessProperties ¶
type AssetSessionAccessProperties struct {
AllowSessionRequests bool `json:"AllowSessionRequests,omitempty"`
SshSessionPort int `json:"SshSessionPort,omitempty"`
RemoteDesktopSessionPort int `json:"RemoteDesktopSessionPort,omitempty"`
TelnetSessionPort int `json:"TelnetSessionPort,omitempty"`
ProtocolId int `json:"ProtocolId,omitempty"`
ProtocolName string `json:"ProtocolName,omitempty"`
ApplicationProperties map[string]interface{} `json:"ApplicationProperties,omitempty"`
}
AssetSessionAccessProperties represents session access configuration for an asset
type AssetSshHostKey ¶
type AssetSshHostKey struct {
Id int `json:"Id"`
Fingerprint string `json:"Fingerprint,omitempty"`
Key string `json:"Key,omitempty"`
KeyType string `json:"KeyType,omitempty"`
Comment string `json:"Comment,omitempty"`
CanBeAccepted bool `json:"CanBeAccepted,omitempty"`
SshHostKey string `json:"SshHostKey"`
FingerprintSha256 string `json:"FingerprintSha256"`
}
AssetSshHostKey represents an SSH Host Key used to identify assets
type AssetTaskProperties ¶
type AssetTaskProperties struct {
HasAssetTaskFailure bool `json:"HasAssetTaskFailure,omitempty"`
LastAccountDiscoveryDate time.Time `json:"LastAccountDiscoveryDate,omitempty"`
LastSuccessAccountDiscoveryDate time.Time `json:"LastSuccessAccountDiscoveryDate,omitempty"`
LastFailureAccountDiscoveryDate time.Time `json:"LastFailureAccountDiscoveryDate,omitempty"`
FailedAccountDiscoveryAttempts int `json:"FailedAccountDiscoveryAttempts,omitempty"`
NextAccountDiscoveryDate time.Time `json:"NextAccountDiscoveryDate,omitempty"`
LastAccountDiscoveryTaskId string `json:"LastAccountDiscoveryTaskId,omitempty"`
LastServiceDiscoveryDate time.Time `json:"LastServiceDiscoveryDate,omitempty"`
LastSuccessServiceDiscoveryDate time.Time `json:"LastSuccessServiceDiscoveryDate,omitempty"`
LastFailureServiceDiscoveryDate time.Time `json:"LastFailureServiceDiscoveryDate,omitempty"`
FailedServiceDiscoveryAttempts int `json:"FailedServiceDiscoveryAttempts,omitempty"`
NextServiceDiscoveryDate time.Time `json:"NextServiceDiscoveryDate,omitempty"`
LastServiceDiscoveryTaskId string `json:"LastServiceDiscoveryTaskId,omitempty"`
LastTestConnectionDate time.Time `json:"LastTestConnectionDate,omitempty"`
LastSuccessTestConnectionDate time.Time `json:"LastSuccessTestConnectionDate,omitempty"`
LastFailureTestConnectionDate time.Time `json:"LastFailureTestConnectionDate,omitempty"`
FailedTestConnectionAttempts int `json:"FailedTestConnectionAttempts,omitempty"`
NextTestConnectionDate time.Time `json:"NextTestConnectionDate,omitempty"`
LastTestConnectionTaskId string `json:"LastTestConnectionTaskId,omitempty"`
LastDependentServiceUpdateDate time.Time `json:"LastDependentServiceUpdateDate,omitempty"`
LastSuccessDependentServiceUpdateDate time.Time `json:"LastSuccessDependentServiceUpdateDate,omitempty"`
LastFailureDependentServiceUpdateDate time.Time `json:"LastFailureDependentServiceUpdateDate,omitempty"`
FailedDependentServiceUpdateAttempts int `json:"FailedDependentServiceUpdateAttempts,omitempty"`
NextDependentServiceUpdateDate time.Time `json:"NextDependentServiceUpdateDate,omitempty"`
LastDependentServiceUpdateTaskId string `json:"LastDependentServiceUpdateTaskId,omitempty"`
}
AssetTaskProperties represents task properties and history for an asset
type AuthProvider ¶
type AuthProvider string
AuthProvider represents the supported authentication provider types.
const ( // AuthProviderCertificate represents certificate-based authentication AuthProviderCertificate AuthProvider = "rsts:sts:primaryproviderid:certificate" // AuthProviderLocal represents local username/password authentication AuthProviderLocal AuthProvider = "rsts:sts:primaryproviderid:local" )
AuthProvider constants define the supported authentication methods.
func (AuthProvider) String ¶
func (a AuthProvider) String() string
String returns the string representation of the AuthProvider.
Returns:
- string: The provider identifier string used in authentication requests.
type AuthenticationProvider ¶
type AuthenticationProvider struct {
Id int `json:"Id,omitempty"`
Name string `json:"Name,omitempty"`
TypeReferenceName string `json:"TypeReferenceName,omitempty"`
IdentityProviderId int `json:"IdentityProviderId,omitempty"`
Identity string `json:"Identity"`
RstsProviderId string `json:"RstsProviderId,omitempty"`
RstsProviderScope string `json:"RstsProviderScope,omitempty"`
IsDefault bool `json:"ForceAsDefault,omitempty"`
// contains filtered or unexported fields
}
func (AuthenticationProvider) ForceAsDefault ¶
func (a AuthenticationProvider) ForceAsDefault() (AuthenticationProvider, error)
ForceAsDefault marks this authentication provider instance as the system default. This is a convenience method that calls ForceAsDefaultAuthProvider with this instance's ID.
Returns:
- AuthenticationProvider: The updated authentication provider configuration
- error: An error if the operation fails or the API request is unsuccessful
func (AuthenticationProvider) SetClient ¶
func (a AuthenticationProvider) SetClient(c *SafeguardClient) any
func (AuthenticationProvider) ToJson ¶
func (a AuthenticationProvider) ToJson() (string, error)
ToJson converts an AuthenticationProvider instance to a JSON string. This is useful for serializing the provider data for transmission or storage.
Returns:
- string: A JSON-encoded string representation of the authentication provider
- error: An error if JSON marshaling encounters any issues
type BatchRequest ¶
type BatchRequest struct {
AccountId int `json:"AccountId,omitempty"`
AssetId int `json:"AssetId,omitempty"`
AccessRequestType AccessRequestType `json:"AccessRequestType,omitempty"`
IsEmergency bool `json:"IsEmergency,omitempty"`
ReasonCodeId int `json:"ReasonCodeId,omitempty"`
ReasonComment string `json:"ReasonComment,omitempty"`
RequestedDurationDays int `json:"RequestedDurationDays,omitempty"`
RequestedDurationHours int `json:"RequestedDurationHours,omitempty"`
RequestedDurationMinutes int `json:"RequestedDurationMinutes,omitempty"`
RequestedFor string `json:"RequestedFor,omitempty"`
TicketNumber string `json:"TicketNumber,omitempty"`
AllowSraSessionLaunch bool `json:"AllowSraSessionLaunch,omitempty"`
}
BatchRequest represents the request portion of a batch response
type ClientHolder ¶
type ClientHolder interface {
SetClient(c *SafeguardClient) any
}
ClientHolder is an interface that defines a method for setting a SafeguardClient. Implementers of this interface should provide the logic for associating a SafeguardClient instance with the implementing type.
SetClient takes a pointer to a SafeguardClient and returns an interface{} which can be used to return any value or type as needed by the implementation.
type ClusterConnectivityHealthDetail ¶
type ClusterConnectivityHealthDetail struct {
Name string `json:"Name"`
Status HealthStatus `json:"Status"`
Description string `json:"Description"`
Target string `json:"Target"`
}
ClusterConnectivityHealthDetail represents connectivity status between nodes
type ClusterMember ¶
type ClusterMember struct {
Id string `json:"Id"`
Name string `json:"Name"`
NetworkAddress string `json:"NetworkAddress"`
Description string `json:"Description"`
IsLeader bool `json:"IsLeader"`
Version string `json:"Version"`
PatchVersion string `json:"PatchVersion"`
State ClusterOperationState `json:"State"`
EnrollmentDate time.Time `json:"EnrollmentDate"`
IsEnrolled bool `json:"IsEnrolled"`
Health NodeHealth `json:"Health"`
NetworkInformation NodeNetworkInformation `json:"NetworkInformation"`
// contains filtered or unexported fields
}
ClusterMember represents a node in the Safeguard cluster
func (ClusterMember) GetHealth ¶
func (c ClusterMember) GetHealth() (*NodeHealth, error)
GetHealth retrieves the current health status information for this cluster member.
The health status includes resource utilization, connectivity status, and any active warnings or errors affecting the node.
Returns:
- *NodeHealth: The current health status and detailed health information
- error: An error if the health status cannot be retrieved
func (ClusterMember) IsClusterLeader ¶
func (c ClusterMember) IsClusterLeader() (bool, error)
IsClusterLeader checks whether this cluster member is currently the cluster leader.
This is a convenience method that checks the leadership status of the current node without requiring a full cluster state query.
Returns:
- bool: true if this member is the leader, false otherwise
- error: An error if the leadership status cannot be determined
func (ClusterMember) SetClient ¶
func (a ClusterMember) SetClient(c *SafeguardClient) any
type ClusterOperationState ¶
type ClusterOperationState string
ClusterOperationState represents the possible states of a cluster operation
const ( ClusterOperationStateUnknown ClusterOperationState = "Unknown" ClusterOperationStateInitializing ClusterOperationState = "Initializing" ClusterOperationStateReady ClusterOperationState = "Ready" ClusterOperationStateInProgress ClusterOperationState = "InProgress" ClusterOperationStateCompleted ClusterOperationState = "Completed" ClusterOperationStateFailed ClusterOperationState = "Failed" )
type ComputerSchemaProperties ¶
type ComputerSchemaProperties struct {
ComputerClassType []string `json:"ComputerClassType,omitempty"`
NameAttribute string `json:"NameAttribute,omitempty"`
DescriptionAttribute string `json:"DescriptionAttribute,omitempty"`
NetworkAddressAttribute string `json:"NetworkAddressAttribute,omitempty"`
OperatingSystemAttribute string `json:"OperatingSystemAttribute,omitempty"`
OperatingSystemVersionAttribute string `json:"OperatingSystemVersionAttribute,omitempty"`
MemberOfAttribute string `json:"MemberOfAttribute,omitempty"`
}
ComputerSchemaProperties represents directory attribute mappings for computers
type ConnectionProperties ¶
type ConnectionProperties struct {
// Service Account Properties
ServiceAccountUniqueObjectId string `json:"ServiceAccountUniqueObjectId,omitempty"`
ServiceAccountSecurityId string `json:"ServiceAccountSecurityId,omitempty"`
ServiceAccountId int `json:"ServiceAccountId,omitempty"`
ServiceAccountName string `json:"ServiceAccountName,omitempty"`
ServiceAccountDomainName string `json:"ServiceAccountDomainName,omitempty"`
ServiceAccountDistinguishedName string `json:"ServiceAccountDistinguishedName,omitempty"`
ServiceAccountNetbiosName string `json:"ServiceAccountNetbiosName,omitempty"`
EffectiveServiceAccountName string `json:"EffectiveServiceAccountName,omitempty"`
EffectiveServiceAccountDistinguishedName string `json:"EffectiveServiceAccountDistinguishedName,omitempty"`
// Credential Properties
ServiceAccountCredentialType string `json:"ServiceAccountCredentialType,omitempty"`
ServiceAccountPassword string `json:"ServiceAccountPassword,omitempty"`
ServiceAccountHasPassword bool `json:"ServiceAccountHasPassword,omitempty"`
ServiceAccountSshKey SshKey `json:"ServiceAccountSshKey,omitempty"` // Changed from SshKeyData to SshKey
ServiceAccountHasSshKey bool `json:"ServiceAccountHasSshKey,omitempty"`
// Connection Settings
UseSslEncryption bool `json:"UseSslEncryption,omitempty"`
VerifySslCertificate bool `json:"VerifySslCertificate,omitempty"`
Port int `json:"Port,omitempty"`
// Asset Properties
ServiceAccountAssetId int `json:"ServiceAccountAssetId,omitempty"`
ServiceAccountAssetName string `json:"ServiceAccountAssetName,omitempty"`
ServiceAccountAssetPlatformId int `json:"ServiceAccountAssetPlatformId,omitempty"`
ServiceAccountAssetPlatformType string `json:"ServiceAccountAssetPlatformType,omitempty"`
ServiceAccountAssetPlatformDisplayName string `json:"ServiceAccountAssetPlatformDisplayName,omitempty"`
}
ConnectionProperties represents connection-specific properties for various services including service account details, credentials, and connection settings
type Credentials ¶
type Credentials struct {
// contains filtered or unexported fields
}
Credentials stores various authentication credentials securely.
type CustomScriptParameter ¶
type CustomScriptParameter struct {
Name string `json:"Name"`
Value string `json:"Value"`
Type string `json:"Type"`
TaskName string `json:"TaskName"`
}
CustomScriptParameter represents a parameter used in custom scripts for password management
type DateTimeInterval ¶
type DateTimeInterval struct {
Begin time.Time `json:"Begin,omitempty"`
End time.Time `json:"End,omitempty"`
}
DateTimeInterval represents a time period with begin and end times
type DirectoryAssetProperties ¶
type DirectoryAssetProperties struct {
DirectoryConnectionProperties DirectoryConnectionProperties `json:"DirectoryConnectionProperties,omitempty"`
DirectoryObjectProperties DirectoryObjectProperties `json:"DirectoryObjectProperties,omitempty"`
ForestRootDomain string `json:"ForestRootDomain,omitempty"`
DomainName string `json:"DomainName,omitempty"`
UsePasswordHash bool `json:"UsePasswordHash,omitempty"`
SynchronizationIntervalMinutes int `json:"SynchronizationIntervalMinutes,omitempty"`
DeleteSyncIntervalMinutes int `json:"DeleteSyncIntervalMinutes,omitempty"`
Domains []Domain `json:"Domains,omitempty"`
DomainControllers []DirectoryDomainController `json:"DomainControllers,omitempty"`
LastSynchronizedDate time.Time `json:"LastSynchronizedDate,omitempty"`
LastSuccessSynchronizedDate time.Time `json:"LastSuccessSynchronizedDate,omitempty"`
LastFailureSynchronizedDate time.Time `json:"LastFailureSynchronizedDate,omitempty"`
FailedSyncAttempts int `json:"FailedSyncAttempts,omitempty"`
LastDirectorySyncTaskId string `json:"LastDirectorySyncTaskId,omitempty"`
NextSynchronizedDate time.Time `json:"NextSynchronizedDate,omitempty"`
LastDeleteSyncDate time.Time `json:"LastDeleteSyncDate,omitempty"`
LastSuccessDeleteSyncDate time.Time `json:"LastSuccessDeleteSyncDate,omitempty"`
LastFailureDeleteSyncDate time.Time `json:"LastFailureDeleteSyncDate,omitempty"`
FailedDeleteSyncAttempts int `json:"FailedDeleteSyncAttempts,omitempty"`
LastDirectoryDeleteSyncTaskId string `json:"LastDirectoryDeleteSyncTaskId,omitempty"`
NextDeleteSyncDate time.Time `json:"NextDeleteSyncDate,omitempty"`
SchemaProperties SchemaProperties `json:"SchemaProperties,omitempty"`
}
DirectoryAssetProperties represents extended properties specific to directory assets
type DirectoryConnectionProperties ¶
type DirectoryConnectionProperties struct {
ServerType DirectoryServerType `json:"ServerType,omitempty"`
UseSSL bool `json:"UseSSL,omitempty"`
SslCertificateId int `json:"SslCertificateId,omitempty"`
DomainControllers []DomainController `json:"DomainControllers,omitempty"`
Domain string `json:"Domain,omitempty"`
Port int `json:"Port,omitempty"`
}
DirectoryConnectionProperties represents connection properties for a directory
type DirectoryDomainController ¶
type DirectoryDomainController struct {
NetworkAddress string `json:"NetworkAddress,omitempty"`
DomainName string `json:"DomainName,omitempty"`
IsWritable bool `json:"IsWritable,omitempty"`
ServerType string `json:"ServerType,omitempty"`
}
DirectoryDomainController represents a directory domain controller
type DirectoryGroupSyncProperties ¶
type DirectoryGroupSyncProperties struct {
PrimaryAuthenticationProviderId int `json:"PrimaryAuthenticationProviderId"`
PrimaryAuthenticationProviderTypeReferenceName string `json:"PrimaryAuthenticationProviderTypeReferenceName"`
PrimaryAuthenticationProviderName string `json:"PrimaryAuthenticationProviderName"`
RequireCertificateAuthentication bool `json:"RequireCertificateAuthentication"`
SecondaryAuthenticationProviderId int `json:"SecondaryAuthenticationProviderId"`
SecondaryAuthenticationProviderTypeReferenceName string `json:"SecondaryAuthenticationProviderTypeReferenceName"`
SecondaryAuthenticationProviderName string `json:"SecondaryAuthenticationProviderName"`
LinkDirectoryAccounts bool `json:"LinkDirectoryAccounts"`
AllowPersonalAccounts bool `json:"AllowPersonalAccounts"`
AdminRoles []string `json:"AdminRoles"`
}
DirectoryGroupSyncProperties represents synchronization properties for groups synced from a directory
type DirectoryObjectProperties ¶
type DirectoryObjectProperties struct {
Container string `json:"Container,omitempty"`
ForestName string `json:"ForestName,omitempty"`
NetBiosName string `json:"NetBiosName,omitempty"`
ObjectClass string `json:"ObjectClass,omitempty"`
ObjectClassGroups string `json:"ObjectClassGroups,omitempty"`
ObjectClassUsers string `json:"ObjectClassUsers,omitempty"`
}
DirectoryObjectProperties represents object properties for a directory
type DirectoryProperties ¶
type DirectoryProperties struct {
DomainName string `json:"DomainName,omitempty"`
ForestRootDomain string `json:"ForestRootDomain,omitempty"`
SynchronizationIntervalMinutes int `json:"SynchronizationIntervalMinutes,omitempty"`
LastSynchronizedDate time.Time `json:"LastSynchronizedDate,omitempty"`
NextSynchronizedDate time.Time `json:"NextSynchronizedDate,omitempty"`
DeleteSyncIntervalMinutes int `json:"DeleteSyncIntervalMinutes,omitempty"`
LastDeleteSyncDate time.Time `json:"LastDeleteSyncDate,omitempty"`
NextDeleteSyncDate time.Time `json:"NextDeleteSyncDate,omitempty"`
LastSuccessSynchronizedDate time.Time `json:"LastSuccessSynchronizedDate,omitempty"`
LastFailureSynchronizedDate time.Time `json:"LastFailureSynchronizedDate,omitempty"`
FailedSyncAttempts int `json:"FailedSyncAttempts,omitempty"`
LastSuccessDeleteSyncDate time.Time `json:"LastSuccessDeleteSyncDate,omitempty"`
LastFailureDeleteSyncDate time.Time `json:"LastFailureDeleteSyncDate,omitempty"`
FailedDeleteSyncAttempts int `json:"FailedDeleteSyncAttempts,omitempty"`
Domains []Domain `json:"Domains,omitempty"`
DomainControllers []DomainController `json:"DomainControllers,omitempty"`
SchemaProperties SchemaProperties `json:"SchemaProperties,omitempty"`
ConnectionProperties ConnectionProperties `json:"ConnectionProperties,omitempty"`
DirectoryId int `json:"DirectoryId"`
DirectoryName string `json:"DirectoryName"`
NetbiosName string `json:"NetbiosName"`
DistinguishedName string `json:"DistinguishedName"`
ObjectGuid string `json:"ObjectGuid"`
ObjectSid string `json:"ObjectSid"`
}
type DirectoryServerType ¶
type DirectoryServerType string
DirectoryServerType represents the type of directory server
const ( DirectoryServerTypeActiveDirectory DirectoryServerType = "ActiveDirectory" DirectoryServerTypeLdap DirectoryServerType = "Ldap" DirectoryServerTypeOther DirectoryServerType = "Other" )
type DirectoryServiceEntry ¶
type DirectoryServiceEntry struct {
Name string `json:"Name"`
DirectoryProperties DirectoryServiceEntryProperty `json:"DirectoryProperties"`
// contains filtered or unexported fields
}
DirectoryServiceEntry represents a Generic Directory Service object containing information about an entry in a directory service such as Active Directory or LDAP.
func (DirectoryServiceEntry) SetClient ¶
func (a DirectoryServiceEntry) SetClient(c *SafeguardClient) any
func (DirectoryServiceEntry) ToJson ¶
func (d DirectoryServiceEntry) ToJson() (string, error)
ToJson serializes a DirectoryServiceEntry instance to its JSON representation.
This method converts the DirectoryServiceEntry and all its nested structures into a JSON string that can be used for transmission or storage.
Returns:
- string: A JSON-encoded string representation of the directory service entry
- error: An error if JSON marshaling encounters any issues with the data structures
type DirectoryServiceEntryProperty ¶
type DirectoryServiceEntryProperty struct {
DirectoryId int `json:"DirectoryId"`
DirectoryName string `json:"DirectoryName"`
DomainName string `json:"DomainName"`
NetbiosName string `json:"NetbiosName"`
DistinguishedName string `json:"DistinguishedName"`
ObjectGuid string `json:"ObjectGuid"`
ObjectSid string `json:"ObjectSid"`
}
DirectoryServiceEntryProperty represents the directory-specific properties of a directory service entry, including identifiers and names used by the directory service.
type DiscoveredGroup ¶
type DiscoveredGroup struct {
DiscoveredGroupId string `json:"DiscoveredGroupId,omitempty"`
DiscoveredGroupName string `json:"DiscoveredGroupName,omitempty"`
DiscoveredGroupDistinguishedName string `json:"DiscoveredGroupDistinguishedName,omitempty"`
}
DiscoveredGroup represents a security group or role that was automatically discovered for an asset account during discovery operations.
type DiscoveredProperties ¶
type DiscoveredProperties struct {
AccountDiscoveryScheduleId int `json:"AccountDiscoveryScheduleId,omitempty"`
AccountDiscoveryScheduleName string `json:"AccountDiscoveryScheduleName,omitempty"`
DiscoveredUserId string `json:"DiscoveredUserId,omitempty"`
DiscoveredDate string `json:"DiscoveredDate,omitempty"`
DiscoveredGroups []DiscoveredGroup `json:"DiscoveredGroups,omitempty"`
}
DiscoveredProperties contains metadata about when and how an account was discovered, including the discovery schedule and discovered group memberships.
type Domain ¶
type Domain struct {
DomainName string `json:"DomainName,omitempty"`
NetBiosName string `json:"NetBiosName,omitempty"`
DomainUniqueId string `json:"DomainUniqueId,omitempty"`
NamingContext string `json:"NamingContext,omitempty"`
IsVisible bool `json:"IsVisible,omitempty"`
IsForestRoot bool `json:"IsForestRoot,omitempty"`
}
type DomainController ¶
type EmergencyAccessProperties ¶
type EmergencyAccessProperties struct {
AllowEmergencyAccess bool `json:"AllowEmergencyAccess,omitempty"`
IgnoreHourlyRestrictions bool `json:"IgnoreHourlyRestrictions,omitempty"`
}
EmergencyAccessProperties represents emergency access settings
type EntitlementType ¶
type EntitlementType string
const ( PasswordEntitlement EntitlementType = "Password" SessionEntitlement EntitlementType = "Session" SshKeyEntitlement EntitlementType = "SshKey" ApiKeyEntitlement EntitlementType = "ApiKey" FileEntitlement EntitlementType = "File" )
type EventData ¶
type EventData struct {
AccessRequestType AccessRequestType `json:"AccessRequestType"`
AccountDistinguishedName string `json:"AccountDistinguishedName"`
AccountDomainName string `json:"AccountDomainName"`
AccountHasTotpAuthenticator bool `json:"AccountHasTotpAuthenticator"`
AccountId int `json:"AccountId"`
AccountName string `json:"AccountName"`
ActionUserIds []int `json:"ActionUserIds"`
ApproverAccessRequestUri string `json:"ApproverAccessRequestUri"`
AssetId int `json:"AssetId"`
AssetName string `json:"AssetName"`
AssetNetworkAddress string `json:"AssetNetworkAddress"`
AssetPlatformType string `json:"AssetPlatformType"`
Comment *string `json:"Comment"`
DurationInMinutes int `json:"DurationInMinutes"`
OfflineWorkflowMode bool `json:"OfflineWorkflowMode"`
Reason *string `json:"Reason"`
ReasonCode *string `json:"ReasonCode"`
Requester string `json:"Requester"`
RequesterAccessRequestUri string `json:"RequesterAccessRequestUri"`
RequesterId int `json:"RequesterId"`
RequesterUsername string `json:"RequesterUsername"`
RequestId string `json:"RequestId"`
RequiredDate time.Time `json:"RequiredDate"`
ReviewerAccessRequestUri string `json:"ReviewerAccessRequestUri"`
SessionSpsNodeIpAddress *string `json:"SessionSpsNodeIpAddress"`
TicketNumber *string `json:"TicketNumber"`
WasCheckedOut bool `json:"WasCheckedOut"`
EventName string `json:"EventName"`
EventTimestamp time.Time `json:"EventTimestamp"`
ApplianceId string `json:"ApplianceId"`
EventUserId int `json:"EventUserId"`
EventUserDisplayName string `json:"EventUserDisplayName"`
EventUserName string `json:"EventUserName"`
EventUserDomainName *string `json:"EventUserDomainName"`
AuditLogUri *string `json:"AuditLogUri"`
EventDisplayName string `json:"EventDisplayName"`
EventDescription string `json:"EventDescription"`
}
EventData represents the Data field of a SignalR event
type EventHandler ¶
type EventHandler struct {
// Channel for handling Events
EventChannel chan SignalREvent
// signalr hub is the signalr client used to register and listen for events from the pam appliance.
signalr.Hub
// contains filtered or unexported fields
}
EventHandler manages SignalR connections and event handling for the Safeguard API
func NewEventHandler ¶
func NewEventHandler(client *SafeguardClient) *EventHandler
NewEventHandler creates a new EventHandler instance with the provided SafeguardClient and initializes the EventChannel.
func (*EventHandler) Log ¶
func (h *EventHandler) Log(keyVals ...interface{}) error
Log logs messages from the signalr client in debug mode.
func (*EventHandler) NotifyEventAsync ¶
func (h *EventHandler) NotifyEventAsync(rawEvent interface{})
func (*EventHandler) Run ¶
func (h *EventHandler) Run(ctx context.Context) error
Run starts the event handler if it is not already running. It validates the access token, creates a SignalR connection and client, and starts the SignalR client. The function blocks until the SignalR client shuts down.
Parameters:
- ctx: The context to control cancellation and timeout.
Returns:
- error: An error if the event handler is already running, token validation fails, creating the SignalR connection or client fails, or if there is an error during the SignalR client's operation.
type ExternalFederation ¶
type ExternalFederation struct {
Realm string `json:"Realm,omitempty"`
FederationMetadata string `json:"FederationMetadata,omitempty"`
AuthnContextClasses string `json:"AuthnContextClasses,omitempty"`
AuthnContextComparison string `json:"AuthnContextComparison,omitempty"`
NameIDFormat string `json:"NameIDFormat,omitempty"`
RequireAuthentication bool `json:"RequireAuthentication,omitempty"`
ApplicationIdOverride string `json:"ApplicationIdOverride,omitempty"`
}
type Fido2Authenticator ¶
type Fido2Properties ¶
type Fido2Properties struct {
DomainSuffix string `json:"DomainSuffix,omitempty"`
}
type Fields ¶
type Fields []string
Fields represents a list of fields to be included in the query results. This allows API consumers to specify which fields they want returned.
func (Fields) ToQueryString ¶
ToQueryString converts the Fields to a URL query string parameter. Returns a string in the format "?fields=field1,field2,field3".
type Filter ¶
type Filter struct {
Fields Fields `json:"fields,omitempty"` // Fields to include in the response
Filter []FilterQuery `json:"filter,omitempty"` // Filter conditions to apply
Orderby OrderBy `json:"orderby,omitempty"` // Fields to order the results by
Count bool `json:"count,omitempty"` // Whether to include a count of total results
}
Filter represents a complete set of query parameters for filtering API results. It combines field selection, filtering conditions, ordering, and count options.
func (*Filter) AddComplexSearchFilter ¶
func (f *Filter) AddComplexSearchFilter(value string, fields map[string]FilterOperator)
AddComplexSearchFilter adds a search filter across multiple fields with OR conditions. This creates a grouped filter like: (field1 op 'value' or field2 op 'value' or field3 op 'value'). Parameters:
- value: The value to search for across all specified fields.
- fields: A map where keys are field names and values are the operators to use.
func (*Filter) AddField ¶
AddField adds a field to the list of fields to be included in the query. Parameters:
- field: The field name to be added.
func (*Filter) AddFilter ¶
func (f *Filter) AddFilter(field string, operator FilterOperator, value string)
AddFilter adds a new filter condition to the Filter. The condition is created using the specified field, operator, and value. Special characters in the value are escaped automatically. Parameters:
- field: The field name to filter on.
- operator: The operator to use for the filter condition.
- value: The value to compare against (will be escaped for special characters).
func (*Filter) AddOrderBy ¶
AddOrderBy adds a field to the list of fields to order the results by. Parameters:
- field: The field name to add to the order by list.
func (*Filter) AddSearchFilter ¶
AddSearchFilter adds a predefined search across common searchable fields. This implements a standard search pattern matching the PAM UI functionality. Parameters:
- searchTerm: The term to search for across multiple predefined fields.
func (*Filter) GetFields ¶
GetFields returns the list of fields to be included in the query response. Returns:
- A copy of the Fields slice.
func (*Filter) GetOrderBy ¶
GetOrderBy returns the list of fields used to order the results. Returns:
- A copy of the OrderBy slice.
func (*Filter) RemoveField ¶
RemoveField removes a field from the list of fields to be included in the query. If the field doesn't exist in the list, no change is made. Parameters:
- field: The field name to be removed.
func (*Filter) RemoveOrderBy ¶
RemoveOrderBy removes a field from the list of fields to order the results by. If the field doesn't exist in the list, no change is made. Parameters:
- field: The field name to be removed from the order by list.
func (*Filter) ToQueryString ¶
ToQueryString generates a complete URL query string based on all filter parameters. The query string includes fields, filter conditions, ordering, and count options. Returns:
- The fully formatted query string starting with "?".
type FilterOperator ¶
type FilterOperator string
FilterOperator represents the operator used in filter conditions. These operators define how values in filter expressions should be compared.
const ( OpEqual FilterOperator = "eq" // Equal OpNotEqual FilterOperator = "ne" // Not equal OpGreaterThan FilterOperator = "gt" // Greater than OpGreaterThanOrEqual FilterOperator = "ge" // Greater than or equal OpLessThan FilterOperator = "lt" // Less than OpLessThanOrEqual FilterOperator = "le" // Less than or equal OpAnd FilterOperator = "and" // Logical AND OpOr FilterOperator = "or" // Logical OR OpNot FilterOperator = "not" // Logical NOT OpContains FilterOperator = "contains" // Contains substring (case sensitive) OpIEqual FilterOperator = "ieq" // Case-insensitive equals OpIContains FilterOperator = "icontains" // Case-insensitive contains OpStartsWith FilterOperator = "sw" // Starts with (case sensitive) OpIStartsWith FilterOperator = "isw" // Case-insensitive starts with OpEndsWith FilterOperator = "ew" // Ends with (case sensitive) OpIEndsWith FilterOperator = "iew" // Case-insensitive ends with OpIn FilterOperator = "in" // Value is in a set )
Standard filter operators supported by the API.
func (FilterOperator) String ¶
func (o FilterOperator) String() string
String returns the string representation of the filter operator.
type FilterQueries ¶
type FilterQueries []FilterQuery
FilterQueries represents a collection of FilterQuery objects. Multiple queries are typically combined with a logical operator like AND or OR.
func (FilterQueries) GroupedWithOperator ¶
func (fq FilterQueries) GroupedWithOperator(operator FilterOperator) string
GroupedWithOperator returns the filter queries as a grouped expression with parentheses using the specified operator (and, or) between conditions. Parameters:
- operator: The operator to use for joining the conditions.
Returns:
- A string with parentheses around the joined conditions if there are multiple conditions.
func (FilterQueries) String ¶
func (fq FilterQueries) String() string
String returns the string representation of filter queries joined by 'and'. This is a convenience method that uses StringWithOperator with the AND operator.
func (FilterQueries) StringWithOperator ¶
func (fq FilterQueries) StringWithOperator(operator FilterOperator) string
StringWithOperator returns the string representation of filter queries joined by the specified operator. Parameters:
- operator: The operator (typically AND or OR) to join the filter queries.
Returns:
- A string with all filter queries joined by the specified operator.
type FilterQuery ¶
type FilterQuery string
FilterQuery represents a single filter condition or a group of conditions. Example: "name eq 'value'" or "(field1 eq 'value1' and field2 eq 'value2')".
func (FilterQuery) String ¶
func (f FilterQuery) String() string
String returns the string representation of the filter query.
type GroupIdentityProvider ¶
type GroupIdentityProvider struct {
Id int `json:"Id"`
Name string `json:"Name"`
TypeReferenceName string `json:"TypeReferenceName"`
IdentityId string `json:"IdentityId"`
}
GroupIdentityProvider represents authentication provider information for a user group
type GroupProperties ¶
type GroupSchemaProperties ¶
type GroupSchemaProperties struct {
GroupClassType []string `json:"GroupClassType,omitempty"`
MemberAttribute string `json:"MemberAttribute,omitempty"`
NameAttribute string `json:"NameAttribute,omitempty"`
}
GroupSchemaProperties represents directory attribute mappings for groups
type HealthDetail ¶
type HealthDetail struct {
Name string `json:"Name"`
Status HealthStatus `json:"Status"`
Description string `json:"Description"`
}
HealthDetail represents a specific health status detail
type HealthStatus ¶
type HealthStatus string
HealthStatus represents the possible health states of a node or service
const ( HealthStatusUnknown HealthStatus = "Unknown" HealthStatusError HealthStatus = "Error" HealthStatusWarning HealthStatus = "Warning" HealthStatusHealthy HealthStatus = "Healthy" )
type HourlyRestrictionProperties ¶
type HourlyRestrictionProperties struct {
EnableHourlyRestrictions bool `json:"EnableHourlyRestrictions"`
MondayValidHours []int `json:"MondayValidHours"`
TuesdayValidHours []int `json:"TuesdayValidHours"`
WednesdayValidHours []int `json:"WednesdayValidHours"`
ThursdayValidHours []int `json:"ThursdayValidHours"`
FridayValidHours []int `json:"FridayValidHours"`
SaturdayValidHours []int `json:"SaturdayValidHours"`
SundayValidHours []int `json:"SundayValidHours"`
}
HourlyRestrictionProperties represents settings controlling when the policy/role will be effective
type Identity ¶
type Identity struct {
DisplayName string `json:"DisplayName,omitempty"`
Id int `json:"Id,omitempty"`
IdentityProviderId int `json:"IdentityProviderId,omitempty"`
IdentityProviderName string `json:"IdentityProviderName,omitempty"`
IdentityProviderTypeReferenceName string `json:"IdentityProviderTypeReferenceName,omitempty"`
IsSystemOwned bool `json:"IsSystemOwned,omitempty"`
Name string `json:"Name,omitempty"`
PrincipalKind string `json:"PrincipalKind,omitempty"`
EmailAddress string `json:"EmailAddress,omitempty"`
DomainName string `json:"DomainName,omitempty"`
FullDisplayName string `json:"FullDisplayName,omitempty"`
// contains filtered or unexported fields
}
Identity represents the user or identity that manages an asset account, including their display name, identity provider details, and contact information.
func (Identity) GetIdentityProvider ¶
func (i Identity) GetIdentityProvider(fields Fields) (IdentityProvider, error)
GetIdentityProvider retrieves the identity provider associated with the given identity. It takes a Fields parameter which can be used to specify additional fields to include in the query. The function constructs a query string based on the identity's ID and the provided fields, sends a GET request to the API, and unmarshals the response into an IdentityProvider object. If successful, it returns the IdentityProvider object with the API client added; otherwise, it returns an error.
Parameters:
- fields: Fields specifying additional fields to include in the query.
Returns:
- IdentityProvider: The identity provider associated with the identity.
- error: An error if the request or unmarshalling fails.
func (Identity) GetUser ¶
GetUser retrieves a User associated with the Identity. It takes a Fields parameter to specify which fields to include in the query. The function constructs a query string using the Identity's Id and the provided fields, then sends a GET request to the API client. If the request is successful, it unmarshals the response into a User object and returns it. If any error occurs during the request or unmarshalling, it returns the error.
Parameters:
- fields: Fields specifying which fields to include in the query.
Returns:
- User: The User associated with the Identity.
- error: An error if the request or unmarshalling fails.
func (Identity) GetUserGroup ¶
GetUserGroup retrieves the UserGroup associated with the Identity. It takes a Fields parameter which specifies the fields to be included in the query. If the fields parameter is not empty, it appends the fields as a query string to the request URL. It returns the UserGroup and an error if any occurred during the request or unmarshalling of the response.
Parameters:
- fields: Fields specifying the fields to be included in the query.
Returns:
- UserGroup: The UserGroup associated with the Identity.
- error: An error if any occurred during the request or unmarshalling of the response.
func (Identity) SetClient ¶
func (a Identity) SetClient(c *SafeguardClient) any
type IdentityProvider ¶
type IdentityProvider struct {
Id int `json:"Id,omitempty"`
TypeReferenceName TypeReferenceName `json:"TypeReferenceName,omitempty"`
Name string `json:"Name,omitempty"`
Description string `json:"Description,omitempty"`
NetworkAddress string `json:"NetworkAddress,omitempty"`
IsSystemOwned bool `json:"IsSystemOwned,omitempty"`
IsDirectory bool `json:"IsDirectory,omitempty"`
RstsProviderId string `json:"RstsProviderId,omitempty"`
RstsProviderScope string `json:"RstsProviderScope,omitempty"`
StarlingProperties StarlingProperties `json:"StarlingProperties,omitempty"`
RadiusProperties RadiusProperties `json:"RadiusProperties,omitempty"`
ExternalFederation ExternalFederation `json:"ExternalFederationProperties,omitempty"`
Fido2Properties Fido2Properties `json:"Fido2Properties,omitempty"`
OneLoginMfa OneLoginMfaProperties `json:"OneLoginMfaProperties,omitempty"`
ScimProperties ScimProperties `json:"ScimProperties,omitempty"`
DirectoryProperties DirectoryProperties `json:"DirectoryProperties,omitempty"`
CreatedDate time.Time `json:"CreatedDate,omitempty"`
CreatedByUserId int `json:"CreatedByUserId,omitempty"`
CreatedByUserDisplayName string `json:"CreatedByUserDisplayName,omitempty"`
// contains filtered or unexported fields
}
IdentityProvider represents the structure for the given JSON array
func (IdentityProvider) Delete ¶
func (idp IdentityProvider) Delete() error
Delete removes the IdentityProvider from the system by calling the apiClient's DeleteIdentityProvider method with the IdentityProvider's Id. It returns an error if the deletion fails.
func (IdentityProvider) GetDirectoryGroups ¶
func (idp IdentityProvider) GetDirectoryGroups(filter Filter) ([]UserGroup, error)
GetDirectoryGroups retrieves groups from this identity provider's directory.
This method is a convenience wrapper around the package-level GetDirectoryGroups function, automatically using this identity provider's ID.
Parameters:
- filter: Query parameters to filter the results (e.g., search text, limit, offset)
Returns:
- []UserGroup: A slice of directory groups matching the filter criteria
- error: An error if the directory cannot be queried or the request fails
func (IdentityProvider) GetDirectoryUsers ¶
func (idp IdentityProvider) GetDirectoryUsers(filter Filter) ([]User, error)
GetDirectoryUsers retrieves users from this identity provider's directory.
This method is a convenience wrapper around the package-level GetDirectoryUsers function, automatically using this identity provider's ID.
Parameters:
- filter: Query parameters to filter the results (e.g., search text, limit, offset)
Returns:
- []User: A slice of directory users matching the filter criteria
- error: An error if the directory cannot be queried or the request fails
func (IdentityProvider) SetClient ¶
func (a IdentityProvider) SetClient(c *SafeguardClient) any
func (IdentityProvider) Synchronize ¶
func (idp IdentityProvider) Synchronize() (ActivityLog, error)
Synchronize synchronizes the identity provider with the external system. It returns an ActivityLog containing details of the synchronization process, or an error if the synchronization fails.
func (IdentityProvider) Update ¶
func (idp IdentityProvider) Update(updatedIdp IdentityProvider) (IdentityProvider, error)
Update updates the current IdentityProvider with the provided updated IdentityProvider. It returns the updated IdentityProvider and an error if the update operation fails.
Parameters:
updatedIdp - The IdentityProvider containing the updated information.
Returns:
IdentityProvider - The updated IdentityProvider. error - An error if the update operation fails, otherwise nil.
type LogEntry ¶
type LogEntry struct {
Timestamp time.Time `json:"Timestamp"`
Status string `json:"Status"`
Message string `json:"Message"`
}
LogEntry represents an individual log message with timestamp, status, and message content
type NodeConnectivityHealth ¶
type NodeConnectivityHealth struct {
Status HealthStatus `json:"Status"`
Details []ClusterConnectivityHealthDetail `json:"Details"`
}
NodeConnectivityHealth represents connectivity health information for a node
type NodeHealth ¶
type NodeHealth struct {
Status HealthStatus `json:"Status"`
Details []HealthDetail `json:"Details"`
LastUpdateTime time.Time `json:"LastUpdateTime"`
ResourceHealth NodeResourceHealth `json:"ResourceHealth"`
ConnectivityHealth NodeConnectivityHealth `json:"ConnectivityHealth"`
}
NodeHealth represents the health status of a cluster node
type NodeNetworkInformation ¶
type NodeNetworkInformation struct {
Ipv4Address string `json:"Ipv4Address"`
Ipv6Address string `json:"Ipv6Address"`
Netmask string `json:"Netmask"`
Gateway string `json:"Gateway"`
DnsServers string `json:"DnsServers"`
UsingDhcp bool `json:"UsingDhcp"`
InterfaceAlias string `json:"InterfaceAlias"`
}
NodeNetworkInformation represents network configuration for a node
type NodeResourceHealth ¶
type NodeResourceHealth struct {
Status HealthStatus `json:"Status"`
Details []NodeResourceHealthDetail `json:"Details"`
}
NodeResourceHealth represents resource health information for a node
type NodeResourceHealthDetail ¶
type NodeResourceHealthDetail struct {
Name string `json:"Name"`
Status HealthStatus `json:"Status"`
Description string `json:"Description"`
}
NodeResourceHealthDetail represents detailed resource health information
type NotificationContact ¶
type NotificationContact struct {
Name string `json:"Name"`
EmailAddress string `json:"EmailAddress,omitempty"`
ContactType NotificationContactType `json:"ContactType"`
UserId int `json:"UserId,omitempty"`
UserDisplayName string `json:"UserDisplayName,omitempty"`
UserGroupId int `json:"UserGroupId,omitempty"`
UserGroupName string `json:"UserGroupName,omitempty"`
}
NotificationContact represents contact info for different roles in access policy
type NotificationContactType ¶
type NotificationContactType string
NotificationContactType represents the type of notification contact
const ( Email NotificationContactType = "Email" SMS NotificationContactType = "SMS" )
type OneLoginMfaProperties ¶
type OrderBy ¶
type OrderBy []string
OrderBy represents a list of fields to order the results by. The order of fields in the slice determines their precedence in sorting.
type PasswordChangeSchedule ¶
type PasswordChangeSchedule struct {
Id int `json:"Id,omitempty"`
Name string `json:"Name,omitempty"`
ScheduleType string `json:"ScheduleType,omitempty"`
TimeZoneId string `json:"TimeZoneId,omitempty"`
Description string `json:"Description,omitempty"`
StartDate time.Time `json:"StartDate,omitempty"`
RepeatInterval int `json:"RepeatInterval,omitempty"`
RepeatIntervalUnit string `json:"RepeatIntervalUnit,omitempty"`
MonthlyScheduleType string `json:"MonthlyScheduleType,omitempty"`
DayOfMonth int `json:"DayOfMonth,omitempty"`
DayOfWeek string `json:"DayOfWeek,omitempty"`
WeekOfMonth string `json:"WeekOfMonth,omitempty"`
TimeOfDayType string `json:"TimeOfDayType,omitempty"`
TimeOfDay string `json:"TimeOfDay,omitempty"`
NoEndDate bool `json:"NoEndDate,omitempty"`
EndDate time.Time `json:"EndDate,omitempty"`
}
PasswordChangeSchedule represents a configuration for scheduled password changes including timing, repetition, and timezone settings
type PasswordCheckSchedule ¶
type PasswordCheckSchedule struct {
Id int `json:"Id,omitempty"`
Name string `json:"Name,omitempty"`
ScheduleType string `json:"ScheduleType,omitempty"`
TimeZoneId string `json:"TimeZoneId,omitempty"`
Description string `json:"Description,omitempty"`
StartDate time.Time `json:"StartDate,omitempty"`
RepeatInterval int `json:"RepeatInterval,omitempty"`
RepeatIntervalUnit string `json:"RepeatIntervalUnit,omitempty"`
MonthlyScheduleType string `json:"MonthlyScheduleType,omitempty"`
DayOfMonth int `json:"DayOfMonth,omitempty"`
DayOfWeek string `json:"DayOfWeek,omitempty"`
WeekOfMonth string `json:"WeekOfMonth,omitempty"`
TimeOfDayType string `json:"TimeOfDayType,omitempty"`
TimeOfDay string `json:"TimeOfDay,omitempty"`
NoEndDate bool `json:"NoEndDate,omitempty"`
EndDate time.Time `json:"EndDate,omitempty"`
}
PasswordCheckSchedule represents a configuration for scheduled password verification including timing, repetition, and timezone settings
type Platform ¶
type Platform struct {
Id int `json:"Id"`
PlatformType PlatformType `json:"PlatformType"`
DisplayName string `json:"DisplayName"`
IsAcctNameCaseSensitive bool `json:"IsAcctNameCaseSensitive"`
SupportsSessionManagement bool `json:"SupportsSessionManagement"`
PlatformFamily PlatformFamily `json:"PlatformFamily"`
}
Platform represents a Safeguard platform configuration
type PlatformFamily ¶
type PlatformFamily string
PlatformFamily represents the family of platform
const ( PlatformFamilyNone PlatformFamily = "None" PlatformFamilyUnix PlatformFamily = "Unix" PlatformFamilyActiveDirectory PlatformFamily = "ActiveDirectory" PlatformFamilyTeamPassword PlatformFamily = "TeamPassword" )
type PlatformType ¶
type PlatformType string
PlatformType represents the type of platform
const ( PlatformTypeACF2 PlatformType = "ACF2" PlatformTypeAcf2Ldap PlatformType = "Acf2Ldap" PlatformTypeAIX PlatformType = "AIX" PlatformTypeAmazonLinux PlatformType = "AmazonLinux" PlatformTypeAS400 PlatformType = "AS400" PlatformTypeAws PlatformType = "Aws" PlatformTypeCheckPoint PlatformType = "CheckPoint" PlatformTypeCiscoASA PlatformType = "CiscoASA" PlatformTypeCiscoIOS PlatformType = "CiscoIOS" PlatformTypeCiscoISE PlatformType = "CiscoISE" PlatformTypeCiscoISECLI PlatformType = "CiscoISECLI" PlatformTypeCiscoNxOs PlatformType = "CiscoNxOs" PlatformTypeCentos PlatformType = "Centos" PlatformTypeCustom PlatformType = "Custom" PlatformTypeDebian PlatformType = "Debian" PlatformTypeDirectory PlatformType = "Directory" PlatformTypeEDirectoryLdap PlatformType = "EDirectoryLdap" PlatformTypeF5BigIp PlatformType = "F5BigIp" PlatformTypeFacebook PlatformType = "Facebook" PlatformTypeFedora PlatformType = "Fedora" PlatformTypeFortinet PlatformType = "Fortinet" PlatformTypeFreeBsd PlatformType = "FreeBsd" PlatformTypeGoogleCloudSecretManager PlatformType = "GoogleCloudSecretManager" PlatformTypeHPiLO PlatformType = "HPiLO" PlatformTypeHPiLOMP PlatformType = "HPiLOMP" PlatformTypeHPUX PlatformType = "HPUX" PlatformTypeiDRAC PlatformType = "iDRAC" PlatformTypeJunOS PlatformType = "JunOS" PlatformTypeKubernetesSecrets PlatformType = "KubernetesSecrets" PlatformTypeLdap PlatformType = "Ldap" PlatformTypeLinuxConnect PlatformType = "LinuxConnect" PlatformTypeLinuxOther PlatformType = "LinuxOther" PlatformTypeLocalhost PlatformType = "LocalHost" PlatformTypeMicrosoftAD PlatformType = "MicrosoftAD" PlatformTypeMongoDB PlatformType = "MongoDB" PlatformTypeMySQL PlatformType = "MySQL" PlatformTypeOracle PlatformType = "Oracle" PlatformTypeOracleLinux PlatformType = "OracleLinux" PlatformTypeOSX PlatformType = "OSX" PlatformTypeOsxConnect PlatformType = "OsxConnect" PlatformTypeOther PlatformType = "Other" PlatformTypeOtherDirectory PlatformType = "OtherDirectory" PlatformTypeOtherManaged PlatformType = "OtherManaged" PlatformTypePanOS PlatformType = "PanOS" PlatformTypePostgreSQL PlatformType = "PostgreSQL" PlatformTypeRACF PlatformType = "RACF" PlatformTypeRacfLdap PlatformType = "RacfLdap" PlatformTypeRedHatDirectory PlatformType = "RedHatDirectory" PlatformTypeRedHatEnterprise PlatformType = "RedHatEnterprise" PlatformTypeSAP PlatformType = "SAP" PlatformTypeSapHana PlatformType = "SapHana" PlatformTypeSafeguardForPrivilegedPasswordsAccounts PlatformType = "SafeguardForPrivilegedPasswordsAccounts" PlatformTypeSafeguardForPrivilegedPasswordsUsers PlatformType = "SafeguardForPrivilegedPasswordsUsers" PlatformTypeSolaris PlatformType = "Solaris" PlatformTypeSonicOs PlatformType = "SonicOs" PlatformTypeSonicWallSma PlatformType = "SonicWallSma" PlatformTypeSPS PlatformType = "SPS" PlatformTypeSqlServer PlatformType = "SqlServer" PlatformTypeStarlingConnect PlatformType = "StarlingConnect" PlatformTypeStarlingDirectory PlatformType = "StarlingDirectory" PlatformTypeSuse PlatformType = "Suse" PlatformTypeSybase PlatformType = "Sybase" PlatformTypeTeamPassword PlatformType = "TeamPassword" PlatformTypeTopSecret PlatformType = "TopSecret" PlatformTypeTopSecretLdap PlatformType = "TopSecretLdap" PlatformTypeTwitter PlatformType = "Twitter" PlatformTypeUbuntu PlatformType = "Ubuntu" PlatformTypeUnknown PlatformType = "Unknown" PlatformTypeVCenter PlatformType = "VCenter" PlatformTypeVSphere PlatformType = "VSphere" PlatformTypeWindows PlatformType = "Windows" PlatformTypeWindowsConnect PlatformType = "WindowsConnect" PlatformTypeWindowsRm PlatformType = "WindowsRm" PlatformTypeWindowsSsh PlatformType = "WindowsSsh" )
type PolicyAccount ¶
type PolicyAccount struct {
Id int `json:"Id"`
Name string `json:"Name"`
Description string `json:"Description"`
HasPassword bool `json:"HasPassword"`
HasSshKey bool `json:"HasSshKey"`
HasTotpAuthenticator bool `json:"HasTotpAuthenticator"`
HasApiKeys bool `json:"HasApiKeys"`
HasFile bool `json:"HasFile"`
DomainName string `json:"DomainName"`
DistinguishedName string `json:"DistinguishedName"`
NetBiosName string `json:"NetBiosName"`
Disabled bool `json:"Disabled"`
AccountType string `json:"AccountType"`
IsServiceAccount bool `json:"IsServiceAccount"`
IsApplicationAccount bool `json:"IsApplicationAccount"`
NotifyOwnersOnly bool `json:"NotifyOwnersOnly"`
SuspendAccountWhenCheckedIn bool `json:"SuspendAccountWhenCheckedIn"`
DemoteAccountWhenCheckedIn bool `json:"DemoteAccountWhenCheckedIn"`
AltLoginName string `json:"AltLoginName"`
PrivilegeGroupMembership string `json:"PrivilegeGroupMembership"`
LinkedUsersCount int `json:"LinkedUsersCount"`
RequestProperties RequestProperties `json:"RequestProperties"`
Platform Platform `json:"Platform"`
Asset Asset `json:"Asset"`
// contains filtered or unexported fields
}
PolicyAccount represents a Safeguard account with its associated policies and properties
func (PolicyAccount) LinkToUser ¶
func (p PolicyAccount) LinkToUser(user User) ([]PolicyAccount, error)
LinkToUser creates a relationship between a policy account and a user.
This method establishes a direct link between the account and user, granting access based on existing policies. The operation is atomic and transactional.
Example:
user := User{Id: 456}
linkedAccounts, err := account.LinkToUser(user)
Parameters:
- user: The User object representing the user to link with
Returns:
- []PolicyAccount: A slice containing the updated account after linking
- error: An error if the link operation fails, nil otherwise
func (PolicyAccount) SetClient ¶
func (a PolicyAccount) SetClient(c *SafeguardClient) any
func (PolicyAccount) ToJson ¶
func (p PolicyAccount) ToJson() (string, error)
ToJson serializes a PolicyAccount object into a JSON string.
This method converts the PolicyAccount instance into a JSON-formatted string, including all defined fields. Empty or zero-valued fields are included in the output.
Example:
account := PolicyAccount{
Name: "webserver-admin",
Description: "Admin account for web servers"
}
json, err := account.ToJson()
Parameters:
- none
Returns:
- string: A JSON representation of the PolicyAccount object
- error: An error if JSON marshaling fails, nil otherwise
func (PolicyAccount) UnlinkFromUser ¶
func (p PolicyAccount) UnlinkFromUser(user User) ([]PolicyAccount, error)
UnlinkFromUser removes the relationship between a policy account and a user.
This method removes direct access between the account and user. The user may still have access through other means (groups, policies etc).
Example:
user := User{Id: 456}
unlinkedAccounts, err := account.UnlinkFromUser(user)
Parameters:
- user: The User object representing the user to unlink from
Returns:
- []PolicyAccount: A slice containing the updated account after unlinking
- error: An error if the unlink operation fails, nil otherwise
type PolicyApproverProperties ¶
type PolicyApproverProperties struct {
RequireApproval bool `json:"RequireApproval"`
RequireReapproval bool `json:"RequireReapproval"`
AutoApproveRequests bool `json:"AutoApproveRequests"`
AllowSelfApproval bool `json:"AllowSelfApproval"`
RequiredApprovers int `json:"RequiredApprovers"`
RequireTimeRestriction bool `json:"RequireTimeRestriction"`
MaximumTimeRestriction int `json:"MaximumTimeRestriction"`
}
PolicyApproverProperties represents settings related to approving an access request
type PolicyAsset ¶
type PolicyAsset struct {
Id int `json:"Id"`
Name string `json:"Name"`
AssetType AssetType `json:"AssetType"`
NetworkAddress string `json:"NetworkAddress"`
Description string `json:"Description"`
AssetPartitionId int `json:"AssetPartitionId"`
AssetPartitionName string `json:"AssetPartitionName"`
DomainName string `json:"DomainName"`
Disabled bool `json:"Disabled"`
Platform PolicyAssetPlatform `json:"Platform"`
SshHostKey AssetSshHostKey `json:"SshHostKey,omitempty"`
SessionAccess SessionAccessProperties `json:"SessionAccessProperties"`
// contains filtered or unexported fields
}
PolicyAsset represents an remote asset available for request. A PolicyAsset is an alternate view of an asset that is used for AccessPolicies, AssetGroups, and UserFavorites. The asset must have AllowSessionRequests set to true in order to be used in UserFavorites or to be able to request a session on the asset.
func (PolicyAsset) GetAssetGroups ¶
func (p PolicyAsset) GetAssetGroups(fields Filter) ([]AssetGroup, error)
GetAssetGroups retrieves all asset groups containing this policy asset.
Returns both direct group memberships and nested group memberships if any exist. The results can be filtered using the fields parameter.
Example:
filter := Filter{}
filter.AddFilter("Disabled", "eq", "false")
groups, err := asset.GetAssetGroups(filter)
Parameters:
- fields: A Filter object to restrict which groups are returned
Returns:
- []AssetGroup: A slice of AssetGroup objects this asset belongs to
- error: An error if the request or response parsing fails, nil otherwise
func (PolicyAsset) GetDirectoryServiceEntries ¶
func (p PolicyAsset) GetDirectoryServiceEntries(fields Filter) ([]DirectoryServiceEntry, error)
GetDirectoryServiceEntries retrieves directory entries for directory assets.
This method is primarily used with directory server assets to list their contained directory entries. Not applicable for non-directory assets.
Example:
filter := Filter{}
entries, err := directoryAsset.GetDirectoryServiceEntries(filter)
Parameters:
- fields: A Filter object to restrict which entries are returned
Returns:
- []DirectoryServiceEntry: A slice of directory entries from this asset
- error: An error if the request or response parsing fails, nil otherwise
func (PolicyAsset) GetPolicies ¶
func (p PolicyAsset) GetPolicies(fields Filter) ([]AssetPolicy, error)
GetPolicies retrieves all access policies affecting this policy asset.
Returns policies that grant access to this asset, either directly or through asset group membership. Includes details about how access was granted.
Example:
filter := Filter{}
policies, err := asset.GetPolicies(filter)
Parameters:
- fields: A Filter object to restrict which policies are returned
Returns:
- []AssetPolicy: A slice of policies granting access to this asset
- error: An error if the request or response parsing fails, nil otherwise
func (PolicyAsset) SetClient ¶
func (a PolicyAsset) SetClient(c *SafeguardClient) any
func (PolicyAsset) ToJson ¶
func (p PolicyAsset) ToJson() (string, error)
ToJson converts a PolicyAsset to its JSON string representation.
Example:
asset := PolicyAsset{...}
json, err := asset.ToJson()
Returns:
- string: A JSON-formatted string containing all non-empty fields of the PolicyAsset
- error: An error if JSON marshaling fails, nil otherwise
type PolicyAssetPlatform ¶
type PolicyAssetPlatform struct {
Id int `json:"Id"`
PlatformType PlatformType `json:"PlatformType"`
DisplayName string `json:"DisplayName"`
SupportsSessionManagement bool `json:"SupportsSessionManagement"`
}
PolicyAssetPlatform represents platform information specific to policy assets
type PolicyEmergencyAccessProperties ¶
type PolicyEmergencyAccessProperties struct {
RequireEmergencyTicketNumber bool `json:"RequireEmergencyTicketNumber"`
EmergencyTicketSystem string `json:"EmergencyTicketSystem"`
}
PolicyEmergencyAccessProperties represents settings related to emergency access
type PolicyInfo ¶
type PolicyInfo struct {
Id int `json:"Id,omitempty"`
Name string `json:"Name,omitempty"`
Priority int `json:"Priority,omitempty"`
RolePriority int `json:"RolePriority,omitempty"`
AccessRequestType AccessRequestType `json:"AccessRequestType,omitempty"`
AllowSimultaneousAccess bool `json:"AllowSimultaneousAccess,omitempty"`
MaximumSimultaneousReleases int `json:"MaximumSimultaneousReleases,omitempty"`
RequesterProperties RequesterProperties `json:"RequesterProperties,omitempty"`
EmergencyAccessProperties EmergencyAccessProperties `json:"EmergencyAccessProperties,omitempty"`
EffectiveExpirationDate *string `json:"EffectiveExpirationDate,omitempty"`
EffectiveHourlyRestrictionProperties HourlyRestrictionProperties `json:"EffectiveHourlyRestrictionProperties,omitempty"`
ReasonCodes []string `json:"ReasonCodes,omitempty"`
}
PolicyInfo represents policy information in entitlement response
type PolicyRequesterProperties ¶
type PolicyRequesterProperties struct {
AllowEmergencyAccess bool `json:"AllowEmergencyAccess"`
AllowUseRequestComments bool `json:"AllowUseRequestComments"`
RequireUseRequestComments bool `json:"RequireUseRequestComments"`
MaximumDaysUntilExpiration int `json:"MaximumDaysUntilExpiration"`
}
PolicyRequesterProperties represents settings for requesting asset/accounts
type PolicyReviewerProperties ¶
type PolicyReviewerProperties struct {
RequireReview bool `json:"RequireReview"`
AllowSelfReview bool `json:"AllowSelfReview"`
RequiredReviewers int `json:"RequiredReviewers"`
}
PolicyReviewerProperties represents settings related to reviewing a password request
type PolicyScopeItem ¶
type PolicyScopeItem struct {
Id int `json:"Id"`
Name string `json:"Name"`
Description string `json:"Description"`
AssetPartitionId int `json:"AssetPartitionId"`
AssetPartitionName string `json:"AssetPartitionName"`
Type string `json:"Type"`
}
PolicyScopeItem represents requestable items governed by policy
type Preference ¶
type Preference struct {
Name string `json:"Name,omitempty"` // The unique identifier/key of the preference
Value string `json:"Value,omitempty"` // The value/setting of the preference
// contains filtered or unexported fields
}
Preference represents a user-specific application setting or preference.
Preferences are key-value pairs that can be used to store user-specific settings like UI preferences, default views, or custom configurations.
Example:
pref := Preference{
Name: "DefaultView",
Value: "grid"
}
func (Preference) SetClient ¶
func (a Preference) SetClient(c *SafeguardClient) any
type Profile ¶
type Profile struct {
Id int `json:"Id,omitempty"`
Name string `json:"Name,omitempty"`
EffectiveId int `json:"EffectiveId,omitempty"`
EffectiveName string `json:"EffectiveName,omitempty"`
}
Profile represents configuration settings that can be applied to an asset account, such as password rules or authentication settings.
type RSTSAuthResponse ¶
type RSTSAuthResponse struct {
sync.RWMutex
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresIn int `json:"expires_in"`
RefreshToken string `json:"refresh_token"`
Scope string `json:"scope"`
// Safeguard specific fields
UserToken string `json:"UserToken"`
Status string `json:"Status"`
IdentityProvider string `json:"IdentityProvider"`
AuthorizationCode string `json:"-"` // Used internally for OAuth flow
AuthTime time.Time `json:"-"` // Time when the token was received
AuthProvider AuthProvider `json:"-"` // Type of authentication provider
// contains filtered or unexported fields
}
RSTSAuthResponse encapsulates authentication data from both RSTS and Safeguard systems. It includes tokens, authentication status, and credentials with thread-safe access.
type RadiusProperties ¶
type RadiusProperties struct {
ServerAddress1 string `json:"ServerAddress1,omitempty"`
ServerAddress2 string `json:"ServerAddress2,omitempty"`
ServerPort int `json:"ServerPort,omitempty"`
Timeout int `json:"Timeout,omitempty"`
Retries int `json:"Retries,omitempty"`
PreAuthenticateForChallengeResponse bool `json:"PreAuthenticateForChallengeResponse,omitempty"`
AlwaysMaskUserInput bool `json:"AlwaysMaskUserInput,omitempty"`
}
type ReasonCode ¶
type ReasonCode struct {
Id int `json:"Id"`
Name string `json:"Name"`
Description string `json:"Description,omitempty"`
Category string `json:"Category,omitempty"`
}
ReasonCode represents a predefined reason for access requests
type ReasonCodeInfo ¶
type ReasonCodeInfo struct {
Id int `json:"Id,omitempty"`
Name string `json:"Name,omitempty"`
Description string `json:"Description,omitempty"`
}
ReasonCodeInfo represents a reason code with additional information
type RegisteredConnector ¶
type RegisteredConnector struct {
Id int `json:"Id,omitempty"`
RegisteredConnectorId string `json:"RegisteredConnectorId,omitempty"`
RegisteredConnectorDisplayName string `json:"RegisteredConnectorDisplayName,omitempty"`
DisplayName string `json:"DisplayName,omitempty"`
StarlingConnectorId string `json:"StarlingConnectorId,omitempty"`
StarlingConnectorVersion string `json:"StarlingConnectorVersion,omitempty"`
Platform Platform `json:"Platform,omitempty"`
VisibleToAllPartitions bool `json:"VisibleToAllPartitions,omitempty"`
VisibleToPartitions []AssetPartition `json:"VisibleToPartitions,omitempty"`
}
RegisteredConnector represents a Starling connector registration
type RemoteDesktopApplicationProperties ¶
type RemoteDesktopApplicationProperties struct {
ApplicationHostAssetId *int `json:"ApplicationHostAssetId"`
ApplicationHostAsset *Asset `json:"ApplicationHostAsset"`
ApplicationHostAccountId *int `json:"ApplicationHostAccountId"`
ApplicationHostLoginAccount *string `json:"ApplicationHostLoginAccount"`
ApplicationDisplayName *string `json:"ApplicationDisplayName"`
ApplicationAlias *string `json:"ApplicationAlias"`
ApplicationProgram *string `json:"ApplicationProgram"`
ApplicationCmdLine *string `json:"ApplicationCmdLine"`
ApplicationHostUserSupplied bool `json:"ApplicationHostUserSupplied"`
}
RemoteDesktopApplicationProperties represents RDP application-specific settings
type RequestProperties ¶
type RequestProperties struct {
AllowPasswordRequest bool `json:"AllowPasswordRequest"`
AllowSessionRequest bool `json:"AllowSessionRequest"`
AllowSshKeyRequest bool `json:"AllowSshKeyRequest"`
AllowApiKeyRequest bool `json:"AllowApiKeyRequest"`
AllowFileRequest bool `json:"AllowFileRequest"`
}
RequestProperties represents the available request types for an account
type RequestStatus ¶
type RequestStatus struct {
State string `json:"State"`
PercentComplete int `json:"PercentComplete"`
Cancellable bool `json:"Cancellable"`
AcceptedTime time.Time `json:"AcceptedTime"`
AcceptanceDuration string `json:"AcceptanceDuration"`
StartTime time.Time `json:"StartTime"`
QueuedDuration string `json:"QueuedDuration"`
EndTime time.Time `json:"EndTime"`
RunningDuration string `json:"RunningDuration"`
TotalDuration string `json:"TotalDuration"`
Message string `json:"Message"`
}
RequestStatus represents the status and timing information of a password request
type RequesterProperties ¶
type RequesterProperties struct {
DefaultReleaseDurationDays int `json:"DefaultReleaseDurationDays,omitempty"`
DefaultReleaseDurationHours int `json:"DefaultReleaseDurationHours,omitempty"`
DefaultReleaseDurationMinutes int `json:"DefaultReleaseDurationMinutes,omitempty"`
MaximumReleaseDurationDays int `json:"MaximumReleaseDurationDays,omitempty"`
MaximumReleaseDurationHours int `json:"MaximumReleaseDurationHours,omitempty"`
MaximumReleaseDurationMinutes int `json:"MaximumReleaseDurationMinutes,omitempty"`
AllowCustomDuration bool `json:"AllowCustomDuration,omitempty"`
RequireReasonCode bool `json:"RequireReasonCode,omitempty"`
RequireReasonComment bool `json:"RequireReasonComment,omitempty"`
RequireServiceTicket bool `json:"RequireServiceTicket,omitempty"`
}
RequesterProperties represents requester properties in policy
func (RequesterProperties) GetDefaultReleaseDuration ¶
func (r RequesterProperties) GetDefaultReleaseDuration() time.Duration
GetDefaultReleaseDuration calculates and returns the default release duration as a time.Duration
func (RequesterProperties) GetMaximumReleaseDuration ¶
func (r RequesterProperties) GetMaximumReleaseDuration() time.Duration
GetMaximumReleaseDuration calculates and returns the maximum release duration as a time.Duration
type ReviewerProperties ¶
type ReviewerProperties struct {
RequiredReviewers int `json:"RequiredReviewers"`
RequireReviewerComment bool `json:"RequireReviewerComment"`
AllowSubsequentAccessRequestsWithoutReview bool `json:"AllowSubsequentAccessRequestsWithoutReview"`
PendingReviewEscalationEnabled bool `json:"PendingReviewEscalationEnabled"`
PendingReviewDurationBeforeEscalationDays int `json:"PendingReviewDurationBeforeEscalationDays"`
PendingReviewDurationBeforeEscalationHours int `json:"PendingReviewDurationBeforeEscalationHours"`
PendingReviewDurationBeforeEscalationMinutes int `json:"PendingReviewDurationBeforeEscalationMinutes"`
}
ReviewerProperties represents settings related to reviewing access requests
type Role ¶
type Role struct {
Id int `json:"Id"`
Name string `json:"Name"`
Priority int `json:"Priority"`
Description string `json:"Description"`
ExpirationDate time.Time `json:"ExpirationDate"`
IsExpired bool `json:"IsExpired"`
HasExpiredPolicies bool `json:"HasExpiredPolicies"`
HasInvalidPolicies bool `json:"HasInvalidPolicies"`
CreatedDate time.Time `json:"CreatedDate"`
CreatedByUserId int `json:"CreatedByUserId"`
CreatedByUserDisplayName string `json:"CreatedByUserDisplayName"`
UserCount int `json:"UserCount"`
AccountCount int `json:"AccountCount"`
AssetCount int `json:"AssetCount"`
PolicyCount int `json:"PolicyCount"`
HourlyRestrictionProperties HourlyRestrictionProperties `json:"HourlyRestrictionProperties"`
Members []RoleMember `json:"Members"`
// contains filtered or unexported fields
}
Role represents roles in Safeguard made up of members, security scopes, and permissions
func (Role) Delete ¶
Delete removes the role identified by the Role's Id from the system. It sends a DELETE request to the API endpoint corresponding to the role's Id. If the request fails, it returns an error.
func (Role) GetMembers ¶
GetMembers retrieves the list of members for the current role instance.
This method is a convenience wrapper around GetRoleMembers that uses the current role's ID.
Example:
filter := Filter{}
members, err := role.GetMembers(filter)
Parameters:
- filter: Filter object to restrict which members are returned
Returns:
- []ManagedByUser: A slice of users who are members of the role
- error: An error if the request fails, nil otherwise
func (Role) GetPolicies ¶
func (r Role) GetPolicies(filter Filter) ([]AccessPolicy, error)
GetPolicies retrieves the list of access policies for the current role instance.
This method is a convenience wrapper around GetRolePolicies that uses the current role's ID.
Example:
filter := Filter{}
policies, err := role.GetPolicies(filter)
Parameters:
- filter: Filter object to restrict which policies are returned
Returns:
- []AccessPolicy: A slice of access policies associated with the role
- error: An error if the request fails, nil otherwise
func (Role) ModifyMembers ¶
func (r Role) ModifyMembers(operation ApiSetOperation, identities []Identity) ([]Identity, error)
ModifyMembers modifies the members of a role by performing the specified operation (add or remove) on the provided identities.
Parameters:
- operation: The operation to perform (e.g., add or remove members).
- identities: A slice of Identity objects representing the members to be added or removed.
Returns:
- A slice of Identity objects representing the updated members of the role.
- An error if the operation fails or if there is an issue with the API request.
Example usage:
updatedMembers, err := role.ModifyMembers(ApiSetOperationAdd, identities)
if err != nil {
log.Fatalf("Failed to modify members: %v", err)
}
func (Role) SetClient ¶
func (a Role) SetClient(c *SafeguardClient) any
func (Role) ToJson ¶
ToJson converts a Role object to its JSON string representation.
Example:
role := Role{
Name: "Administrator",
Description: "Full system access"
}
json, err := role.ToJson()
Returns:
- string: JSON representation of the role
- error: An error if marshaling fails, nil otherwise
func (Role) Update ¶
Update updates the current Role with the provided updatedRole. It sends a PUT request to the API with the updated role data in JSON format. If the request is successful, it unmarshals the response into a Role object and returns the updated Role with the API client added. If an error occurs during marshalling, sending the request, or unmarshalling the response, it returns an empty Role and the error.
Parameters:
updatedRole - The Role object containing the updated role data.
Returns:
Role - The updated Role object with the API client added. error - An error if any occurred during the update process.
type RoleMember ¶
type RoleMember struct {
DisplayName string `json:"DisplayName"`
Id int `json:"Id"`
IdentityProviderId int `json:"IdentityProviderId"`
IdentityProviderName string `json:"IdentityProviderName"`
IdentityProviderTypeReferenceName string `json:"IdentityProviderTypeReferenceName"`
IsSystemOwned bool `json:"IsSystemOwned"`
Name string `json:"Name"`
PrincipalKind string `json:"PrincipalKind"`
EmailAddress string `json:"EmailAddress"`
DomainName string `json:"DomainName"`
FullDisplayName string `json:"FullDisplayName"`
}
RoleMember represents a member of a role
type RuleConditionGroup ¶
type RuleConditionGroup struct {
LogicalJoinType string `json:"LogicalJoinType"`
Children []RuleConditionOrGroup `json:"Children"`
}
RuleConditionGroup represents a group of conditions for asset grouping rules
type RuleConditionOrGroup ¶
type RuleConditionOrGroup struct {
TaggingGroupingCondition *TaggingGroupingCondition `json:"TaggingGroupingCondition,omitempty"`
TaggingGroupingConditionGroup string `json:"TaggingGroupingConditionGroup,omitempty"`
}
RuleConditionOrGroup represents either a condition or a group of conditions
type SafeHeaders ¶ added in v0.1.5
type SafeHeaders struct {
// contains filtered or unexported fields
}
SafeHeaders is a wrapper around http.Header that implements slog.LogValuer to safely log headers with sensitive information masked.
func NewSafeHeaders ¶ added in v0.1.5
func NewSafeHeaders(headers http.Header) SafeHeaders
NewSafeHeaders creates a SafeHeaders wrapper for the given http.Header.
func (SafeHeaders) LogValue ¶ added in v0.1.5
func (sh SafeHeaders) LogValue() slog.Value
LogValue implements slog.LogValuer to provide safe logging of HTTP headers. It masks sensitive authorization headers while preserving other header information.
type SafeResponseBody ¶ added in v0.1.6
type SafeResponseBody struct {
// contains filtered or unexported fields
}
SafeResponseBody is a wrapper around response body that implements slog.LogValuer to safely log response bodies with sensitive information masked.
func NewSafeResponseBody ¶ added in v0.1.6
func NewSafeResponseBody(body []byte, path string) SafeResponseBody
NewSafeResponseBody creates a SafeResponseBody wrapper for the given response body and path.
func (SafeResponseBody) LogValue ¶ added in v0.1.6
func (srb SafeResponseBody) LogValue() slog.Value
LogValue implements slog.LogValuer to provide safe logging of HTTP response bodies. It masks password responses while preserving other response information.
type SafeguardClient ¶
type SafeguardClient struct {
AccessToken *RSTSAuthResponse
Appliance applianceURL
ClusterLeader applianceURL
ApiVersion string
HttpClient *http.Client
DefaultHeaders http.Header
Logger *slog.Logger
SignalRClient *EventHandler
// contains filtered or unexported fields
}
SafeguardClient represents the main client for interacting with the Safeguard API. It handles authentication, request routing, and session management.
func NewClient ¶
func NewClient(applianceUrl string, apiVersion string, debug bool) *SafeguardClient
Returns a pointer to a SafeguardClient instance. NewClient creates a new instance of SafeguardClient. It initializes the logger with the specified debug level and sets it as the default logger. If an existing client instance (sgclient) already exists, it returns that instance. Otherwise, it creates a new SafeguardClient with the provided appliance URL, API version, and other necessary configurations. It also starts a goroutine to refresh the token periodically.
Parameters:
- applianceUrl: The URL of the appliance to connect to.
- apiVersion: The version of the API to use.
- debug: A boolean flag to enable or disable debug logging.
Returns:
A pointer to the newly created or existing SafeguardClient instance.
func (*SafeguardClient) AddIdentityProvider ¶
func (c *SafeguardClient) AddIdentityProvider(idp IdentityProvider) (IdentityProvider, error)
AddIdentityProvider adds a new identity provider to the Safeguard system. It takes an IdentityProvider object as input and returns the created IdentityProvider object along with any error encountered during the process.
Parameters:
- idp: IdentityProvider object containing the details of the identity provider to be added.
Returns:
- IdentityProvider: The newly created IdentityProvider object.
- error: An error object if an error occurred, otherwise nil.
func (*SafeguardClient) AddLinkedAccounts ¶
func (c *SafeguardClient) AddLinkedAccounts(user User, policyAccount []PolicyAccount) ([]PolicyAccount, error)
AddLinkedAccounts adds policy accounts to a user's linked accounts.
This method associates the specified policy accounts with the given user.
Example:
accounts := []PolicyAccount{{Id: 123}, {Id: 456}}
linked, err := AddLinkedAccounts(user, accounts)
Parameters:
- user: The user to link accounts to
- policyAccount: A slice of policy accounts to link
Returns:
- []PolicyAccount: The linked policy accounts
- error: An error if the operation fails, nil otherwise
func (*SafeguardClient) CancelAccessRequest ¶
func (c *SafeguardClient) CancelAccessRequest(id string) (AccessRequest, error)
CancelAccessRequest cancels an access request with the given ID using the provided SafeguardClient. It sends a POST request to the "AccessRequests/{id}/Cancel" endpoint and unmarshals the response into an AccessRequest object.
Parameters:
- c: A pointer to a SafeguardClient used to make the request.
- id: The ID of the access request to be canceled.
Returns:
- AccessRequest: The canceled access request object.
- error: An error object if the request fails or if there is an issue unmarshaling the response.
func (*SafeguardClient) CheckInAccessRequest ¶
func (c *SafeguardClient) CheckInAccessRequest(id string) (AccessRequest, error)
CheckInAccessRequest checks in an access request with the given ID using the provided SafeguardClient. It sends a POST request to the "AccessRequests/{id}/CheckIn" endpoint and unmarshals the response into an AccessRequest object.
Parameters:
- c: A pointer to a SafeguardClient used to make the request.
- id: The ID of the access request to check in.
Returns:
- AccessRequest: The checked-in access request object.
- error: An error object if an error occurred during the request or unmarshalling.
func (*SafeguardClient) CheckOutPassword ¶
func (c *SafeguardClient) CheckOutPassword(ctx context.Context, accessRequest AccessRequest, shouldWaitForPending bool) (string, error)
CheckOutPassword checks out the password for the access request. It returns the password as a string and an error if the operation fails.
Parameters:
- ctx: The context for the operation, which can be used to cancel the request.
- c: The SafeguardClient instance for making API requests.
- accessRequest: The access request for which the password is being checked out.
- waitForPending: A boolean indicating whether to wait for the access request to become valid if it is in a pending state.
Returns:
- string: The checked-out password.
- error: An error if the password checkout fails.
func (*SafeguardClient) ClearDefaultAuthProvider ¶
func (c *SafeguardClient) ClearDefaultAuthProvider() error
ClearDefaultAuthProvider removes the current default authentication provider setting. After calling this, no authentication provider will be marked as default.
Returns:
- error: An error if the operation fails or the API request is unsuccessful
func (*SafeguardClient) CreateAssetAccount ¶
func (c *SafeguardClient) CreateAssetAccount(assetAccount AssetAccount) (AssetAccount, error)
CreateAssetAccount creates a new asset account in Safeguard. Parameters:
- c: The SafeguardClient instance for making API requests
- assetAccount: The AssetAccount object containing the account details to create
Returns:
- AssetAccount: The newly created asset account with updated fields
- error: An error if the creation fails, nil otherwise
func (*SafeguardClient) CreateAssetAccounts ¶
func (c *SafeguardClient) CreateAssetAccounts(assetAccounts []AssetAccount) ([]AssetAccount, error)
CreateAssetAccounts creates multiple asset accounts in a single batch request. Parameters:
- c: The SafeguardClient instance for making API requests
- assetAccounts: A slice of AssetAccount objects to create
Returns:
- []AssetAccount: A slice of the newly created asset accounts
- error: An error if any of the creations fail, nil otherwise
func (*SafeguardClient) CreateUser ¶
func (c *SafeguardClient) CreateUser(user User) (User, error)
CreateUser creates a new user in Safeguard.
This method creates a new user with the provided user details and returns the created user object.
Example:
newUser := User{
Name: "john.smith",
EmailAddress: "john.smith@example.com"
}
created, err := CreateUser(newUser)
Parameters:
- user: The user object containing the new user's details
Returns:
- User: The created user object
- error: An error if the creation fails, nil otherwise
func (*SafeguardClient) DeleteAccessPolicy ¶
func (c *SafeguardClient) DeleteAccessPolicy(id int) error
DeleteAccessPolicy deletes an access policy with the given ID. It uses the global client reference to make the API request.
Parameters:
- id: An integer representing the ID of the access policy to be deleted.
Returns:
- error: An error object if the DELETE request fails, otherwise nil.
func (*SafeguardClient) DeleteAssetAccount ¶
func (c *SafeguardClient) DeleteAssetAccount(id int) error
DeleteAssetAccount deletes an asset account from Safeguard. Parameters:
- c: The SafeguardClient instance for making API requests
- id: The ID of the asset account to delete
Returns:
- error: An error if the deletion fails, nil otherwise
func (*SafeguardClient) DeleteAssetGroup ¶
func (c *SafeguardClient) DeleteAssetGroup(id int) error
DeleteAssetGroup removes an asset group from the system.
Parameters:
- id: Unique identifier of the asset group to delete
Returns:
- (error): An error if the deletion fails
func (*SafeguardClient) DeleteAssetPartition ¶
func (c *SafeguardClient) DeleteAssetPartition(id int) error
DeleteAssetPartition removes an asset partition from the system.
Parameters:
- id: Unique identifier of the asset partition to delete
Returns:
- (error): An error if the deletion fails
func (*SafeguardClient) DeleteIdentityProvider ¶
func (c *SafeguardClient) DeleteIdentityProvider(id int) error
DeleteIdentityProvider deletes an identity provider by its ID.
Parameters:
id - The ID of the identity provider to be deleted.
Returns:
error - An error object if the deletion fails, otherwise nil.
func (*SafeguardClient) DeleteRequest ¶
func (c *SafeguardClient) DeleteRequest(path string) ([]byte, error)
DeleteRequest sends an HTTP DELETE request to remove resources. It ensures proper routing through the cluster leader for consistency.
Parameters:
- path: The endpoint path identifying the resource to delete.
Returns:
- []byte: The response body if any.
- error: An error if the deletion fails.
func (*SafeguardClient) DeleteUser ¶
func (c *SafeguardClient) DeleteUser(id int) error
DeleteUser removes a user from Safeguard.
This method permanently deletes the specified user from the system.
Example:
err := DeleteUser(123)
Parameters:
- id: The unique identifier of the user to delete
Returns:
- error: An error if the deletion fails, nil otherwise
func (*SafeguardClient) DisableAssetAccount ¶
func (c *SafeguardClient) DisableAssetAccount(assetAccount AssetAccount) (AssetAccount, error)
DisableAssetAccount disables an asset account in Safeguard. Parameters:
- c: The SafeguardClient instance for making API requests
- assetAccount: The AssetAccount to disable
Returns:
- AssetAccount: The updated asset account reflecting the disabled state
- error: An error if the disable operation fails, nil otherwise
func (*SafeguardClient) EnableAssetAccount ¶
func (c *SafeguardClient) EnableAssetAccount(assetAccount AssetAccount) (AssetAccount, error)
EnableAssetAccount enables a previously disabled asset account in Safeguard. Parameters:
- c: The SafeguardClient instance for making API requests
- assetAccount: The AssetAccount to enable
Returns:
- AssetAccount: The updated asset account reflecting the enabled state
- error: An error if the enable operation fails, nil otherwise
func (*SafeguardClient) ForceAsDefaultAuthProvider ¶
func (c *SafeguardClient) ForceAsDefaultAuthProvider(id int) (AuthenticationProvider, error)
ForceAsDefaultAuthProvider sets a specific authentication provider as the system default. Only one provider can be the default at any time.
Parameters:
- id: The unique identifier of the authentication provider to set as default
Returns:
- AuthenticationProvider: The updated authentication provider configuration
- error: An error if the operation fails or the provider cannot be found
func (*SafeguardClient) ForceClusterHealthCheck ¶
func (c *SafeguardClient) ForceClusterHealthCheck() (ClusterMember, error)
ForceClusterHealthCheck triggers an immediate health check of the cluster.
This operation initiates a comprehensive health assessment of the current node, including resource utilization, connectivity, and service status checks.
Returns:
- ClusterMember: The cluster member representing the current node with updated health status
- error: An error if the health check fails to complete or the response cannot be parsed
func (*SafeguardClient) GetAccessPolicies ¶
func (c *SafeguardClient) GetAccessPolicies(filter Filter) ([]AccessPolicy, error)
GetAccessPolicies retrieves a list of access policies from the Safeguard API. It takes a Filter as parameter and uses the global client reference to make the API request.
Parameters:
- filter: A Filter object used to filter the access policies.
Returns:
- A slice of AccessPolicy objects.
- An error if the request fails or the response cannot be unmarshaled.
func (*SafeguardClient) GetAccessPolicy ¶
func (c *SafeguardClient) GetAccessPolicy(id int, fields Fields) (AccessPolicy, error)
GetAccessPolicy retrieves an access policy by its ID from the Safeguard API. It uses the global client reference to make the API request.
Parameters:
- id: An integer representing the ID of the access policy to retrieve.
- fields: Optional fields to include in the query.
Returns:
- AccessPolicy: The retrieved access policy.
- error: An error if any occurred during the request or unmarshalling process.
func (*SafeguardClient) GetAccessRequest ¶
func (c *SafeguardClient) GetAccessRequest(id string, fields Fields) (AccessRequest, error)
GetAccessRequest retrieves a specific access request by its ID.
Parameters:
- id: The unique identifier of the access request.
- fields: Optional fields to include in the response.
Returns:
- AccessRequest: The retrieved access request.
- error: An error if the request fails or unmarshalling fails.
func (*SafeguardClient) GetAccessRequests ¶
func (c *SafeguardClient) GetAccessRequests(filter Filter) ([]AccessRequest, error)
GetAccessRequests retrieves access requests filtered by the provided criteria. The requests are sorted by creation date in descending order.
Parameters:
- filter: Filter criteria for the requests
Returns:
- []AccessRequest: Matching access requests
- error: API or unmarshalling errors
func (*SafeguardClient) GetAccountTaskSchedules ¶
func (c *SafeguardClient) GetAccountTaskSchedules(taskName TaskNames, filter Filter) ([]AccountTaskData, error)
GetAccountTaskSchedules retrieves account task schedules matching specified criteria.
This method returns task schedules for a given task type that match the provided filter conditions. The response includes details about schedule timing, status, and associated assets/accounts.
Example:
filter := Filter{}
filter.AddFilter("Disabled", "eq", "false")
schedules, err := GetAccountTaskSchedules(CheckPassword, filter)
Parameters:
- taskName: The type of account task to retrieve schedules for
- filter: A Filter object containing field comparisons and ordering preferences
Returns:
- []AccountTaskData: A slice of task schedules matching the filter criteria
- error: An error if the request or response parsing fails, nil otherwise
func (*SafeguardClient) GetAsset ¶
func (c *SafeguardClient) GetAsset(id int, fields Fields) (Asset, error)
GetAsset retrieves a single asset by its ID.
Parameters:
- id: Unique identifier of the asset
- fields: Optional fields to include in the response
Returns:
- (Asset): The requested asset
- (error): An error if the API request fails
func (*SafeguardClient) GetAssetAccount ¶
func (c *SafeguardClient) GetAssetAccount(id int, fields Fields) (AssetAccount, error)
GetAssetAccount retrieves a specific asset account by ID from Safeguard. Parameters:
- c: The SafeguardClient instance for making API requests
- id: The ID of the asset account to retrieve
- fields: Specific fields to include in the response
Returns:
- AssetAccount: The requested asset account
- error: An error if the request fails, nil otherwise
func (*SafeguardClient) GetAssetAccounts ¶
func (c *SafeguardClient) GetAssetAccounts(filter Filter) ([]AssetAccount, error)
GetAssetAccounts retrieves accounts matching the provided filter.
Parameters:
- filter: Query parameters for filtering accounts
Returns:
- []AssetAccount: Matching accounts
- error: API or unmarshalling errors
func (*SafeguardClient) GetAssetDirectoryAccounts ¶
func (c *SafeguardClient) GetAssetDirectoryAccounts(assetId int, filter Filter) ([]AssetAccount, error)
GetAssetDirectoryAccounts retrieves all directory accounts associated with the specified asset.
Parameters:
- assetId: Unique identifier of the asset
- filter: Query parameters to filter the results
Returns:
- ([]AssetAccount): Slice of matching directory accounts
- (error): An error if the API request fails
func (*SafeguardClient) GetAssetDirectoryAssets ¶
func (c *SafeguardClient) GetAssetDirectoryAssets(assetId int, filter Filter) ([]Asset, error)
GetAssetDirectoryAssets retrieves all directory assets associated with the specified asset.
Parameters:
- assetId: Unique identifier of the asset
- filter: Query parameters to filter the results
Returns:
- ([]Asset): Slice of matching directory assets
- (error): An error if the API request fails
func (*SafeguardClient) GetAssetDirectoryServiceEntries ¶
func (c *SafeguardClient) GetAssetDirectoryServiceEntries(assetId int, filter Filter) ([]DirectoryServiceEntry, error)
GetAssetDirectoryServiceEntries retrieves all directory service entries associated with the specified asset.
Parameters:
- assetId: Unique identifier of the asset
- filter: Query parameters to filter the results
Returns:
- ([]DirectoryServiceEntry): Slice of matching directory service entries
- (error): An error if the API request fails
func (*SafeguardClient) GetAssetGroup ¶
func (c *SafeguardClient) GetAssetGroup(id int, fields Fields) (AssetGroup, error)
GetAssetGroup retrieves a single asset group by its ID.
Parameters:
- id: Unique identifier of the asset group
- fields: Optional fields to include in the response
Returns:
- (AssetGroup): The requested asset group
- (error): An error if the API request fails
func (*SafeguardClient) GetAssetGroups ¶
func (c *SafeguardClient) GetAssetGroups(filter Filter) ([]AssetGroup, error)
GetAssetGroups retrieves all asset groups matching the specified filter criteria.
Parameters:
- filter: Query parameters to filter the results
Returns:
- ([]AssetGroup): Slice of matching asset groups
- (error): An error if the API request fails
func (*SafeguardClient) GetAssetPartition ¶
func (c *SafeguardClient) GetAssetPartition(id int, fields Fields) (AssetPartition, error)
GetAssetPartition retrieves a single asset partition by its ID.
Parameters:
- id: Unique identifier of the asset partition
- fields: Optional fields to include in the response
Returns:
- (AssetPartition): The requested asset partition
- (error): An error if the API request fails
func (*SafeguardClient) GetAssetPartitions ¶
func (c *SafeguardClient) GetAssetPartitions(filter Filter) ([]AssetPartition, error)
GetAssetPartitions retrieves all asset partitions matching the specified filter criteria.
Parameters:
- filter: Query parameters to filter the results
Returns:
- ([]AssetPartition): Slice of matching asset partitions
- (error): An error if the API request fails
func (*SafeguardClient) GetAssets ¶
func (c *SafeguardClient) GetAssets(fields Filter) ([]Asset, error)
GetAssets retrieves all assets matching the specified filter criteria.
Parameters:
- filter: Query parameters to filter the results
Returns:
- ([]Asset): Slice of matching assets
- (error): An error if the API request fails
func (*SafeguardClient) GetAuthenticationProvider ¶
func (c *SafeguardClient) GetAuthenticationProvider(id int) (AuthenticationProvider, error)
GetAuthenticationProvider retrieves a specific authentication provider by its ID. Use this to get detailed information about a single provider configuration.
Parameters:
- id: The unique identifier of the authentication provider to retrieve
Returns:
- AuthenticationProvider: The requested authentication provider's configuration
- error: An error if the provider cannot be found or the request fails
func (*SafeguardClient) GetAuthenticationProviders ¶
func (c *SafeguardClient) GetAuthenticationProviders() ([]AuthenticationProvider, error)
GetAuthenticationProviders retrieves all authentication providers configured in Safeguard. This includes all provider types like LDAP, RADIUS, certificate-based, etc.
Returns:
- []AuthenticationProvider: A slice containing all configured authentication providers
- error: An error if the API request fails or the response cannot be parsed
func (*SafeguardClient) GetClusterLeader ¶
func (c *SafeguardClient) GetClusterLeader() (ClusterMember, error)
GetClusterLeader identifies and retrieves the current leader of the Safeguard cluster.
A healthy cluster should have exactly one leader at any given time. The leader is responsible for coordinating cluster-wide operations and maintaining consistency.
Returns:
- ClusterMember: The cluster member that is currently the leader, or nil if no leader is found
- error: An error if no leader is found, multiple leaders are detected, or the request fails
func (*SafeguardClient) GetClusterMember ¶
func (c *SafeguardClient) GetClusterMember(id string) (ClusterMember, error)
GetClusterMember retrieves detailed information about a specific cluster member.
Parameters:
- id: The unique identifier (GUID) of the cluster member to retrieve
Returns:
- ClusterMember: The requested cluster member's configuration and status, or nil if not found
- error: An error if the member cannot be found or the request fails
func (*SafeguardClient) GetClusterMembers ¶
func (c *SafeguardClient) GetClusterMembers(filter Filter) ([]ClusterMember, error)
GetClusterMembers retrieves all members that are part of the Safeguard cluster. Use filters to narrow down the results based on specific criteria.
Parameters:
- filter: A Filter object containing query parameters to filter the results
Returns:
- []ClusterMember: A slice of cluster members matching the filter criteria
- error: An error if the API request fails or the response cannot be parsed
func (*SafeguardClient) GetDirectoryGroups ¶
func (c *SafeguardClient) GetDirectoryGroups(id int, filter Filter) ([]UserGroup, error)
GetDirectoryGroups retrieves groups from a specific identity provider's directory.
This function only works with identity providers that are directories (IsDirectory = true). It supports pagination and filtering through the filter parameter.
Parameters:
- id: The ID of the directory identity provider
- filter: Query parameters to filter the results (e.g., search text, limit, offset)
Returns:
- []UserGroup: A slice of directory groups matching the filter criteria
- error: An error if the directory cannot be queried or the request fails
func (*SafeguardClient) GetDirectoryUsers ¶
func (c *SafeguardClient) GetDirectoryUsers(identityProviderId int, filter Filter) ([]User, error)
GetDirectoryUsers retrieves users from a specific identity provider's directory.
This function only works with identity providers that are directories (IsDirectory = true). It supports pagination and filtering through the filter parameter.
Parameters:
- identityProviderId: The ID of the directory identity provider
- filter: Query parameters to filter the results (e.g., search text, limit, offset)
Returns:
- []User: A slice of directory users matching the filter criteria
- error: An error if the directory cannot be queried or the request fails
func (*SafeguardClient) GetEntitlement ¶
func (c *SafeguardClient) GetEntitlement(id int, fields Fields) (Role, error)
GetEntitlement is an alias for GetRole that retrieves details for a specific role.
This method provides compatibility with systems that use the term "entitlement" instead of "role". It has identical functionality to GetRole.
Example:
fields := Fields{}
entitlement, err := GetEntitlement(123, fields)
Parameters:
- id: The unique identifier of the role to retrieve
- fields: Optional Fields object specifying which related objects to include
Returns:
- Role: The requested role with all specified related objects
- error: An error if the role is not found or request fails, nil otherwise
func (*SafeguardClient) GetEntitlements ¶
func (c *SafeguardClient) GetEntitlements(fields Filter) ([]Role, error)
GetEntitlements is an alias for GetRoles that retrieves a list of roles from Safeguard.
This method provides compatibility with systems that use the term "entitlements" instead of "roles". It has identical functionality to GetRoles.
Example:
filter := Filter{}
entitlements, err := GetEntitlements(filter)
Parameters:
- fields: Filter object containing field comparisons and ordering preferences
Returns:
- []Role: A slice of roles matching the filter criteria
- error: An error if the request fails, nil otherwise
func (*SafeguardClient) GetGroups ¶
func (c *SafeguardClient) GetGroups(id string) ([]UserGroup, error)
GetGroups retrieves the groups that a specific user belongs to.
This method returns all user groups that the specified user is a member of.
Example:
groups, err := GetGroups("123")
Parameters:
- id: The string identifier of the user
Returns:
- []UserGroup: A slice of user groups
- error: An error if the request fails, nil otherwise
func (*SafeguardClient) GetIdentities ¶
func (c *SafeguardClient) GetIdentities(filter Filter) ([]Identity, error)
func (*SafeguardClient) GetIdentity ¶
func (c *SafeguardClient) GetIdentity(id int, fields Fields) (Identity, error)
func (*SafeguardClient) GetIdentityProvider ¶
func (c *SafeguardClient) GetIdentityProvider(id int) (IdentityProvider, error)
GetIdentityProvider retrieves a specific identity provider by its ID.
This function fetches detailed configuration information for a single identity provider, including all its type-specific properties and settings.
Parameters:
- id: The unique identifier of the identity provider
Returns:
- IdentityProvider: The requested identity provider's complete configuration
- error: An error if the provider cannot be found or the request fails
func (*SafeguardClient) GetIdentityProviders ¶
func (c *SafeguardClient) GetIdentityProviders() ([]IdentityProvider, error)
GetIdentityProviders retrieves all configured identity providers from Safeguard.
This function returns all authentication sources configured in the system, including: - Directory services (Active Directory, LDAP) - Federation providers (SAML, OAuth) - Other authentication methods (RADIUS, Starling, etc.)
Returns:
- []IdentityProvider: A slice of all configured identity providers
- error: An error if the API request fails or response cannot be parsed
func (*SafeguardClient) GetLinkedAccounts ¶
func (c *SafeguardClient) GetLinkedAccounts(id string) ([]PolicyAccount, error)
GetLinkedAccounts retrieves the policy accounts linked to a specific user ID.
This method returns all policy accounts that are linked to the specified user.
Example:
accounts, err := GetLinkedAccounts("123")
Parameters:
- id: The string identifier of the user
Returns:
- []PolicyAccount: A slice of linked policy accounts
- error: An error if the request fails, nil otherwise
func (*SafeguardClient) GetMe ¶
func (c *SafeguardClient) GetMe(filter Filter) (User, error)
GetMe retrieves information about the currently authenticated user.
Returns:
- User: The user information for the authenticated user
- error: An error if the request fails or the response cannot be parsed
func (*SafeguardClient) GetMeAccessRequestAsset ¶
func (c *SafeguardClient) GetMeAccessRequestAsset(assetId string) (PolicyAsset, error)
GetMeAccessRequestAsset retrieves a specific asset that the current user can request access to.
Parameters:
- assetId: The ID of the asset to retrieve information for
Returns:
- PolicyAsset: The requested asset's information
- error: An error if the asset cannot be found or the request fails
func (*SafeguardClient) GetMeAccessRequestAssets ¶
func (c *SafeguardClient) GetMeAccessRequestAssets(filter Filter) ([]PolicyAsset, error)
GetMeAccessRequestAssets retrieves all assets that the current user can request access to.
Parameters:
- filter: Filter criteria to narrow down the results
Returns:
- []PolicyAsset: A slice of assets the user can request access to
- error: An error if the request fails or the response cannot be parsed
func (*SafeguardClient) GetMeAccountEntitlements ¶
func (c *SafeguardClient) GetMeAccountEntitlements(accessRequestType AccessRequestType, includeActiveRequests bool, filterByCredential bool, filter Filter) ([]AccountEntitlement, error)
GetMeAccountEntitlements retrieves the account entitlements for the current user.
Parameters:
- accessRequestType: Optional type of access request to filter by
- includeActiveRequests: If true, includes currently active requests in the response
- filterByCredential: If true, filters results by credential type
- filter: Additional filter criteria to narrow down the results
Returns:
- []AccountEntitlement: A slice of account entitlements for the user
- error: An error if the request fails or the response cannot be parsed
func (*SafeguardClient) GetMeActionableRequests ¶
func (c *SafeguardClient) GetMeActionableRequests(filter Filter) (map[AccessRequestRole][]AccessRequest, error)
GetMeActionableRequests retrieves access requests that require action from the current user.
Parameters:
- filter: Filter criteria to narrow down the results
Returns:
- map[AccessRequestRole][]AccessRequest: Access requests grouped by role
- error: An error if the request fails or the response cannot be parsed
func (*SafeguardClient) GetMeActionableRequestsByRole ¶
func (c *SafeguardClient) GetMeActionableRequestsByRole(role AccessRequestRole, filter Filter) ([]AccessRequest, error)
GetMeActionableRequestsByRole retrieves access requests for a specific role that require action.
Parameters:
- role: The specific role to filter requests by
- filter: Additional filter criteria to narrow down the results
Returns:
- []AccessRequest: Access requests for the specified role
- error: An error if the request fails or the response cannot be parsed
func (*SafeguardClient) GetMeActionableRequestsDetailed ¶
func (c *SafeguardClient) GetMeActionableRequestsDetailed(filter Filter) (ActionableRequestsResult, error)
GetMeActionableRequestsDetailed provides a detailed analysis of actionable access requests. This is a convenience method that processes the results from GetMeActionableRequests and provides additional helper information.
Parameters:
- filter: Filter criteria to narrow down the results
Returns:
- ActionableRequestsResult: Processed access requests with additional metadata
- error: An error if the request fails or the response cannot be parsed
func (*SafeguardClient) GetPasswordRules ¶
func (c *SafeguardClient) GetPasswordRules(assetPartition AssetPartition, filter Filter) ([]AccountPasswordRule, error)
GetPasswordRules retrieves password rules for the specified asset partition.
Parameters:
- assetPartition: The partition to get rules for
- filter: Query parameters to filter the results
Returns:
- ([]AccountPasswordRule): Slice of matching password rules
- (error): An error if the API request fails or no rules are found
func (*SafeguardClient) GetPolicyAccount ¶
func (c *SafeguardClient) GetPolicyAccount(id int, fields Fields) (PolicyAccount, error)
GetPolicyAccount retrieves a single policy account by its unique identifier.
The method can include additional related objects in the response based on the provided fields parameter.
Example:
fields := Fields{}
fields.Add("Asset", "Platform", "Owner")
account, err := GetPolicyAccount(123, fields)
Parameters:
- id: The unique identifier of the policy account to retrieve
- fields: Optional Fields object specifying which related objects to include
Returns:
- PolicyAccount: The requested policy account with all specified related objects
- error: An error if the account is not found or request fails, nil otherwise
func (*SafeguardClient) GetPolicyAccounts ¶
func (c *SafeguardClient) GetPolicyAccounts(fields Filter) ([]PolicyAccount, error)
GetPolicyAccounts retrieves all policy accounts that match the specified filter criteria.
The method supports filtering accounts based on various properties like Name, Disabled, PlatformId etc. Multiple filters can be combined to narrow down results.
Example:
fields := Filter{}
fields.AddFilter("Disabled", "eq", "false")
fields.AddFilter("PlatformId", "eq", "1")
accounts, err := GetPolicyAccounts(fields)
Parameters:
- fields: A Filter object containing field comparisons and ordering preferences
Returns:
- []PolicyAccount: A slice of PolicyAccount objects matching the filter criteria
- error: An error if the request fails or response parsing fails, nil otherwise
func (*SafeguardClient) GetPolicyAsset ¶
func (c *SafeguardClient) GetPolicyAsset(id int, fields Fields) (PolicyAsset, error)
GetPolicyAsset retrieves a single policy asset by its unique identifier.
The method supports including additional related objects based on the fields parameter. Common fields include Platform, SessionAccess, and SshHostKey.
Example:
fields := Fields{}
fields.Add("Platform", "SessionAccess")
asset, err := GetPolicyAsset(123, fields)
Parameters:
- id: The unique identifier of the policy asset to retrieve
- fields: Optional Fields object specifying which related objects to include
Returns:
- PolicyAsset: The requested policy asset with all specified related objects
- error: An error if the asset is not found or request fails, nil otherwise
func (*SafeguardClient) GetPolicyAssets ¶
func (c *SafeguardClient) GetPolicyAssets(fields Filter) ([]PolicyAsset, error)
GetPolicyAssets retrieves policy assets based on filter criteria.
This method returns assets that match all specified filter conditions. Commonly used filters include Disabled, PlatformId, and AssetPartitionId.
Example:
filter := Filter{}
filter.AddFilter("Disabled", "eq", "false")
filter.AddFilter("PlatformId", "eq", "1")
assets, err := GetPolicyAssets(filter)
Parameters:
- fields: A Filter object containing field comparisons and ordering preferences
Returns:
- []PolicyAsset: A slice of PolicyAsset objects matching the filter criteria
- error: An error if the request or response parsing fails, nil otherwise
func (*SafeguardClient) GetRequest ¶
func (c *SafeguardClient) GetRequest(path string) ([]byte, error)
GetRequest makes a GET request to the specified path on the Safeguard API. It constructs the full URL by combining the read-only root URL with the provided path, creates an HTTP GET request, and sends it using the client's HTTP configuration.
Parameters:
- path: The API endpoint path to append to the root URL.
Returns:
- []byte: The response body from the API call.
- error: An error if the request fails or returns a non-successful status code.
func (*SafeguardClient) GetRole ¶
func (c *SafeguardClient) GetRole(id int, fields Fields) (Role, error)
GetRole retrieves details for a specific role by ID.
This method returns detailed information about a single role, optionally including related objects specified in the fields parameter.
Example:
fields := Fields{}
fields.Add("Members", "Policies")
role, err := GetRole(123, fields)
Parameters:
- id: The unique identifier of the role to retrieve
- fields: Optional Fields object specifying which related objects to include
Returns:
- Role: The requested role with all specified related objects
- error: An error if the role is not found or request fails, nil otherwise
func (*SafeguardClient) GetRoleMembers ¶
func (c *SafeguardClient) GetRoleMembers(id int, filter Filter) ([]Identity, error)
GetRoleMembers retrieves the list of members belonging to a specific role.
This method returns all users who are members of the specified role, with optional filtering to restrict the results.
Example:
filter := Filter{}
filter.AddFilter("PrincipalKind", "eq", "User")
members, err := GetRoleMembers(123, filter)
Parameters:
- id: The unique identifier of the role
- filter: Filter object to restrict which members are returned
Returns:
- []ManagedByUser: A slice of users who are members of the role
- error: An error if the request fails, nil otherwise
func (*SafeguardClient) GetRolePolicies ¶
func (c *SafeguardClient) GetRolePolicies(id int, filter Filter) ([]AccessPolicy, error)
GetRolePolicies retrieves the list of access policies associated with a specific role.
This method returns all access policies that are linked to the specified role, with optional filtering to restrict the results.
Example:
filter := Filter{}
filter.AddFilter("IsExpired", "eq", "false")
policies, err := GetRolePolicies(123, filter)
Parameters:
- id: The unique identifier of the role
- filter: Filter object to restrict which policies are returned
Returns:
- []AccessPolicy: A slice of access policies associated with the role
- error: An error if the request fails, nil otherwise
func (*SafeguardClient) GetRoles ¶
func (c *SafeguardClient) GetRoles(fields Filter) ([]Role, error)
GetRoles retrieves a list of roles from Safeguard.
This method returns all roles matching the specified filter criteria. Common filters include Name, IsExpired, and CreatedDate.
Example:
filter := Filter{}
filter.AddFilter("IsExpired", "eq", "false")
roles, err := GetRoles(filter)
Parameters:
- fields: Filter object containing field comparisons and ordering preferences
Returns:
- []Role: A slice of roles matching the filter criteria
- error: An error if the request fails, nil otherwise
func (*SafeguardClient) GetTokenExpirationTime ¶
func (c *SafeguardClient) GetTokenExpirationTime() time.Time
GetTokenExpirationTime returns the time when the current access token will expire GetTokenExpirationTime returns the expiration time of the access token. It calculates the expiration time by adding the token's lifespan (ExpiresIn) to the authentication time (AuthTime).
Returns:
time.Time: The expiration time of the access token.
func (*SafeguardClient) GetUser ¶
func (c *SafeguardClient) GetUser(id int, fields Fields) (User, error)
GetUser retrieves details for a specific user by ID.
This method returns detailed information about a single user, optionally including related objects specified in the fields parameter.
Example:
fields := Fields{}
fields.Add("LinkedAccounts", "Preferences")
user, err := GetUser(123, fields)
Parameters:
- id: The unique identifier of the user to retrieve
- fields: Optional Fields object specifying which related objects to include
Returns:
- User: The requested user with all specified related objects
- error: An error if the user is not found or request fails, nil otherwise
func (*SafeguardClient) GetUserGroup ¶
func (c *SafeguardClient) GetUserGroup(id int, fields Fields) (UserGroup, error)
GetUserGroup retrieves a single user group by its unique identifier.
The method can include additional related objects in the response based on the provided fields parameter.
Example:
fields := Fields{}
fields.Add("Members", "DirectoryProperties")
group, err := GetUserGroup(123, fields)
Parameters:
- id: The unique identifier of the user group to retrieve
- fields: Optional Fields object specifying which related objects to include
Returns:
- UserGroup: The requested user group with all specified related objects
- error: An error if the group is not found or request fails, nil otherwise
func (*SafeguardClient) GetUserGroups ¶
func (c *SafeguardClient) GetUserGroups(fields Filter) ([]UserGroup, error)
GetUserGroups retrieves all user groups that match the specified filter criteria.
The method supports filtering groups based on various properties like Name, IsReadOnly, CreatedDate etc. Multiple filters can be combined to narrow down results.
Example:
fields := Filter{}
fields.AddFilter("IsReadOnly", "eq", "false")
fields.AddFilter("Name", "contains", "admin")
groups, err := GetUserGroups(fields)
Parameters:
- fields: A Filter object containing field comparisons and ordering preferences
Returns:
- []UserGroup: A slice of UserGroup objects matching the filter criteria
- error: An error if the request fails or response parsing fails, nil otherwise
func (*SafeguardClient) GetUserPreferences ¶
func (c *SafeguardClient) GetUserPreferences(id int) ([]Preference, error)
GetUserPreferences retrieves the preferences for a specific user.
This method returns all preferences associated with the specified user ID.
Example:
prefs, err := GetUserPreferences(123)
Parameters:
- id: The unique identifier of the user
Returns:
- []Preference: A slice of user preferences
- error: An error if the request fails, nil otherwise
func (*SafeguardClient) GetUserRoles ¶
func (c *SafeguardClient) GetUserRoles(id string) ([]Role, error)
GetUserRoles retrieves the roles assigned to a specific user.
This method returns all roles that have been assigned to the specified user.
Example:
roles, err := GetUserRoles("123")
Parameters:
- id: The string identifier of the user
Returns:
- []Role: A slice of assigned roles
- error: An error if the request fails, nil otherwise
func (*SafeguardClient) GetUsers ¶
func (c *SafeguardClient) GetUsers(filter Filter) ([]User, error)
GetUsers retrieves a list of users from Safeguard.
This method returns all users matching the specified filter criteria. Common filters include Name, EmailAddress, and Disabled.
Example:
filter := Filter{}
filter.AddFilter("Disabled", "eq", "false")
users, err := GetUsers(filter)
Parameters:
- fields: Filter object containing field comparisons and ordering preferences
Returns:
- []User: A slice of users matching the filter criteria
- error: An error if the request fails, nil otherwise
func (*SafeguardClient) IsTokenExpired ¶
func (c *SafeguardClient) IsTokenExpired() bool
IsTokenExpired checks if the current access token has expired IsTokenExpired checks if the current access token is expired. It returns true if the access token is nil, the authentication time is zero, or the current time is after the token's expiration time.
func (*SafeguardClient) LoginWithCertificate ¶
func (c *SafeguardClient) LoginWithCertificate(certPath, certPassword string) error
LoginWithCertificate authenticates using a PKCS12 certificate file. Parameters: - certPath: Path to the PKCS12 certificate file - certPassword: Password for the certificate - authProvider: The authentication provider to use (e.g. "certificate") Returns an error if the authentication fails.
func (*SafeguardClient) LoginWithOauth ¶
func (c *SafeguardClient) LoginWithOauth() error
LoginWithOauth initiates the OAuth2.0 authorization code flow to obtain an access token. It generates a code challenge and starts a TCP listener to receive the authorization code. The user is prompted to log in using their browser, and upon successful login, the authorization code is exchanged for an access token. Returns an error if the authentication or token exchange process fails.
func (*SafeguardClient) LoginWithPassword ¶
func (c *SafeguardClient) LoginWithPassword(username, password string) error
LoginWithPassword authenticates a user using their username and password. It first obtains an RSTS token and then exchanges it for a Safeguard token. The obtained token is stored in the SafeguardClient's AccessToken field.
Parameters:
- username: The username of the user.
- password: The password of the user.
Returns:
- error: An error if the login process fails, otherwise nil.
The function automatically handles:
- RSTS token acquisition
- Token exchange for Safeguard access
- Token storage and management
- Error handling and logging
func (*SafeguardClient) NewAccessRequests ¶
func (c *SafeguardClient) NewAccessRequests(accountEntitlements []AccountEntitlement, requestDuration time.Duration) ([]AccessRequestBatchResponse, error)
NewAccessRequests creates multiple access requests in a single batch operation.
Parameters:
- accountEntitlements: Slice of account entitlements to request access for.
Returns:
- []AccessRequestBatchResponse: Responses for each request in the batch.
- error: An error if the batch operation fails.
func (*SafeguardClient) NewSignalRClient ¶
func (c *SafeguardClient) NewSignalRClient() *EventHandler
func (*SafeguardClient) PostRequest ¶
PostRequest sends an HTTP POST request to the specified path with the provided body. It automatically handles authentication, request routing, and response processing.
Parameters:
- path: The endpoint path to which the request will be sent.
- body: The request body data as an io.Reader.
Returns:
- []byte: The response body from the API call.
- error: An error if the request fails or returns a non-successful status code.
func (*SafeguardClient) PutRequest ¶
PutRequest sends an HTTP PUT request to update resources on the Safeguard API. It automatically handles authentication and routes requests through the cluster leader.
Parameters:
- path: The endpoint path for the resource to update.
- body: The request body containing the update data.
Returns:
- []byte: The response body from the API call.
- error: An error if the request fails.
func (*SafeguardClient) RemainingTokenTime ¶
func (c *SafeguardClient) RemainingTokenTime() time.Duration
RemainingTokenTime returns the duration until the token expires RemainingTokenTime returns the remaining time until the access token expires. If the access token is nil or the authentication time is zero, it returns a duration of zero.
func (*SafeguardClient) RemoveLinkedAccounts ¶
func (c *SafeguardClient) RemoveLinkedAccounts(user User, policyAccount []PolicyAccount) ([]PolicyAccount, error)
RemoveLinkedAccounts removes policy accounts from a user's linked accounts.
This method removes the association between the specified policy accounts and the given user.
Example:
accounts := []PolicyAccount{{Id: 123}}
removed, err := RemoveLinkedAccounts(user, accounts)
Parameters:
- user: The user to remove links from
- policyAccount: A slice of policy accounts to unlink
Returns:
- []PolicyAccount: The unlinked policy accounts
- error: An error if the operation fails, nil otherwise
func (*SafeguardClient) SaveAccessTokenToEnv ¶
func (c *SafeguardClient) SaveAccessTokenToEnv() error
SaveAccessTokenToEnv saves the current access token to an environment variable. This allows persistence of the token across sessions.
Returns:
- error: An error if saving the token fails.
func (*SafeguardClient) SuspendAssetAccount ¶
func (c *SafeguardClient) SuspendAssetAccount(a AssetAccount) (ActivityLog, error)
SuspendAssetAccount suspends an asset account in Safeguard. Parameters:
- c: The SafeguardClient instance for making API requests
- a: The AssetAccount to suspend
Returns:
- PasswordActivityLog: Log details of the suspend activity
- error: An error if the suspend operation fails, nil otherwise
func (*SafeguardClient) SynchronizeIdentityProvider ¶
func (c *SafeguardClient) SynchronizeIdentityProvider(id int) (ActivityLog, error)
SynchronizeIdentityProvider synchronizes the identity provider with the given ID. It sends a POST request to the "IdentityProviders/{id}/Synchronize" endpoint and returns the resulting ActivityLog or an error if the request or unmarshalling fails.
Parameters:
- id: The ID of the identity provider to synchronize.
Returns:
- ActivityLog: The activity log resulting from the synchronization.
- error: An error if the request or unmarshalling fails.
func (*SafeguardClient) UpdateAccessPolicy ¶
func (c *SafeguardClient) UpdateAccessPolicy(id int, updatedAccessPolicy AccessPolicy) (AccessPolicy, error)
UpdateAccessPolicy updates an existing access policy with the provided details. It takes the ID of the access policy to update and an AccessPolicy object containing the updated values. The method makes a PUT request to the Safeguard API, updates the access policy, and returns the updated AccessPolicy object with the client reference attached.
Parameters:
- id: The unique identifier of the access policy to update
- updatedAccessPolicy: AccessPolicy object containing the updated values
Returns:
- AccessPolicy: The updated access policy object
- error: An error if the update operation fails
func (*SafeguardClient) UpdateAsset ¶
func (c *SafeguardClient) UpdateAsset(id int, updatedAsset Asset) (Asset, error)
UpdateAsset updates an existing asset identified by the given ID with the provided updated asset details. It sends a PUT request to the "Assets/{id}" endpoint with the updated asset data in JSON format. If the update is successful, it returns the updated asset and a nil error. If there is an error during the process, it returns an empty asset and the error.
Parameters:
- id: The ID of the asset to be updated.
- updatedAsset: The Asset struct containing the updated asset details.
Returns:
- Asset: The updated Asset struct.
- error: An error if the update process fails, otherwise nil.
func (*SafeguardClient) UpdateAssetAccount ¶
func (c *SafeguardClient) UpdateAssetAccount(assetAccount AssetAccount) (AssetAccount, error)
UpdateAssetAccount updates an existing asset account in Safeguard. Parameters:
- c: The SafeguardClient instance for making API requests
- assetAccount: The AssetAccount object containing the updated account details
Returns:
- AssetAccount: The updated asset account with current fields
- error: An error if the update fails, nil otherwise
func (*SafeguardClient) UpdateAssetGroup ¶
func (c *SafeguardClient) UpdateAssetGroup(id int, assetGroup AssetGroup) (AssetGroup, error)
UpdateAssetGroup modifies an existing asset group.
Parameters:
- id: Unique identifier of the asset group to update
- assetGroup: Modified asset group data
Returns:
- (AssetGroup): The updated asset group
- (error): An error if the update fails
func (*SafeguardClient) UpdateIdentityProvider ¶
func (c *SafeguardClient) UpdateIdentityProvider(id int, updatedIdp IdentityProvider) (IdentityProvider, error)
UpdateIdentityProvider updates an existing identity provider with the given ID using the provided updated identity provider data. It sends a PUT request to the "IdentityProviders/{id}" endpoint with the updated data in JSON format. If the request is successful, it unmarshals the response into an IdentityProvider object and returns it. If there is an error during the process, it returns an empty IdentityProvider object and the error.
Parameters:
- id: The ID of the identity provider to update.
- updatedIdp: The updated identity provider data.
Returns:
- IdentityProvider: The updated identity provider object.
- error: An error object if there was an issue with the update process, otherwise nil.
func (*SafeguardClient) UpdatePasswordProfile ¶
func (c *SafeguardClient) UpdatePasswordProfile(assetAccount AssetAccount, passwordPolicy AccountPasswordRule) (AssetAccount, error)
UpdatePasswordProfile updates the password profile for an asset account. Parameters:
- c: The SafeguardClient instance for making API requests
- assetAccount: The AssetAccount object to update
- passwordPolicy: The AccountPasswordRule to apply to the account
Returns:
- AssetAccount: The updated asset account with the new password profile
- error: An error if the update fails, nil otherwise
func (*SafeguardClient) ValidateAccessToken ¶
func (c *SafeguardClient) ValidateAccessToken() error
ValidateAccessToken checks if the current access token is valid by testing it against the Safeguard API. It verifies both token format and server acceptance.
Returns:
- error: An error if the token is invalid or validation fails.
type Schedule ¶
type Schedule struct {
Id int `json:"Id"`
Name string `json:"Name"`
Description string `json:"Description"`
NotifyOwnersOnly bool `json:"NotifyOwnersOnly"`
NotifyOwnersOnMismatch bool `json:"NotifyOwnersOnMismatch"`
ResetOnMismatch bool `json:"ResetOnMismatch"`
ScheduleType string `json:"ScheduleType"`
TimeZoneId string `json:"TimeZoneId"`
TimeZoneDisplayName string `json:"TimeZoneDisplayName"`
RepeatInterval int `json:"RepeatInterval"`
RepeatMonthlyScheduleType string `json:"RepeatMonthlyScheduleType"`
RepeatWeekOfMonth string `json:"RepeatWeekOfMonth"`
RepeatDayOfWeek string `json:"RepeatDayOfWeek"`
RepeatDayOfMonth int `json:"RepeatDayOfMonth"`
RepeatDaysOfWeek []string `json:"RepeatDaysOfWeek"`
TimeOfDayType string `json:"TimeOfDayType"`
StartHour int `json:"StartHour"`
StartMinute int `json:"StartMinute"`
TimeOfDayIntervals []TimeOfDayInterval `json:"TimeOfDayIntervals"`
}
Schedule represents a task schedule configuration
type ScheduleInterval ¶
type ScheduleInterval struct {
RepeatInterval int `json:"RepeatInterval,omitempty"`
RepeatIntervalUnit string `json:"RepeatIntervalUnit,omitempty"`
}
ScheduleInterval represents a time interval configuration for scheduled tasks
type ScheduledAccountTask ¶
type ScheduledAccountTask struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Schedule string `json:"schedule"` // Cron expression
Enabled bool `json:"enabled"`
TaskType TaskNames `json:"taskType"`
LastRun string `json:"lastRun,omitempty"`
NextRun string `json:"nextRun,omitempty"`
TaskProperties TaskProperties `json:"taskProperties"`
}
ScheduledAccountTask represents a scheduled task that runs against accounts
type SchemaProperties ¶
type SchemaProperties struct {
UserProperties UserSchemaProperties `json:"UserProperties,omitempty"`
GroupProperties GroupSchemaProperties `json:"GroupProperties,omitempty"`
ComputerProperties ComputerSchemaProperties `json:"ComputerProperties,omitempty"`
}
SchemaProperties represents directory schema mappings
type ScimProperties ¶
type ScimProperties struct {
UserTemplate UserTemplate `json:"UserTemplate,omitempty"`
TenantUrl string `json:"TenantUrl,omitempty"`
HasToken bool `json:"HasToken,omitempty"`
TokenCreationDate time.Time `json:"TokenCreationDate,omitempty"`
}
type ServiceAccountCredentialType ¶
type ServiceAccountCredentialType string
ServiceAccountCredentialType represents the type of credential used for the service account
const ( ServiceAccountCredentialTypePassword ServiceAccountCredentialType = "Password" ServiceAccountCredentialTypeSshKey ServiceAccountCredentialType = "SshKey" ServiceAccountCredentialTypeNone ServiceAccountCredentialType = "None" )
type SessionAccessAccountType ¶
type SessionAccessAccountType string
SessionAccessAccountType represents the type of session access account
const ( None SessionAccessAccountType = "None" LinkedAccount SessionAccessAccountType = "LinkedAccount" Custom SessionAccessAccountType = "Custom" )
type SessionAccessProperties ¶
type SessionAccessProperties struct {
AllowSessionRequests bool `json:"AllowSessionRequests"`
SshSessionPort int `json:"SshSessionPort,omitempty"`
RemoteDesktopSessionPort int `json:"RemoteDesktopSessionPort,omitempty"`
TelnetSessionPort int `json:"TelnetSessionPort,omitempty"`
}
SessionAccessProperties represents the session access configuration for a policy asset
type SessionProperties ¶
type SessionProperties struct {
SessionModuleConnectionId int `json:"SessionModuleConnectionId"`
SessionConnectionPolicyRef string `json:"SessionConnectionPolicyRef"`
RdpShowWallpaper bool `json:"RdpShowWallpaper"`
RemoteDesktopApplicationProperties *RemoteDesktopApplicationProperties `json:"RemoteDesktopApplicationProperties"`
}
SessionProperties represents session-specific configuration
type SignalREvent ¶
type SignalREvent struct {
ApplianceId string `json:"ApplianceId"`
Name string `json:"Name"`
Time time.Time `json:"Time"`
Message string `json:"Message"`
AuditLogUri *string `json:"AuditLogUri"`
Data EventData `json:"Data"`
}
SignalREvent represents the root structure of a SignalR event notification
type SshKey ¶
type SshKey struct {
PrivateKey string `json:"PrivateKey,omitempty"`
Passphrase string `json:"Passphrase,omitempty"`
PublicKey string `json:"PublicKey,omitempty"`
Comment string `json:"Comment,omitempty"`
Fingerprint string `json:"Fingerprint,omitempty"`
FingerprintSha256 string `json:"FingerprintSha256,omitempty"`
KeyType string `json:"KeyType,omitempty"`
KeyLength int `json:"KeyLength,omitempty"`
}
SshKey represents SSH key information as specified in swagger.json
type SshKeyFormat ¶
type SshKeyFormat string
SshKeyFormat specifies supported SSH key formats
const ( SshKeyFormatUnknown SshKeyFormat = "Unknown" SshKeyFormatOpenSsh SshKeyFormat = "OpenSsh" SshKeyFormatSSH2 SshKeyFormat = "SSH2" SshKeyFormatPuttyPPK SshKeyFormat = "PuttyPPK" SshKeyFormatSecureCRT SshKeyFormat = "SecureCRT" )
type SshKeyType ¶
type SshKeyType string
SshKeyType specifies supported SSH key types
const ( SshKeyTypeUnknown SshKeyType = "Unknown" SshKeyTypeDSA SshKeyType = "DSA" SshKeyTypeRSA SshKeyType = "RSA" SshKeyTypeECDSA SshKeyType = "ECDSA" SshKeyTypeED25519 SshKeyType = "ED25519" )
type StarlingAssetProperties ¶
type StarlingAssetProperties struct {
UniqueId string `json:"UniqueId,omitempty"`
HostName string `json:"HostName,omitempty"`
NetworkAddress string `json:"NetworkAddress,omitempty"`
ServiceAccountName string `json:"ServiceAccountName,omitempty"`
}
StarlingAssetProperties represents properties specific to Starling assets
type StarlingProperties ¶
type StarlingProperties struct {
HasApiKey bool `json:"HasApiKey,omitempty"`
}
type SyncGroup ¶
type SyncGroup struct {
Id int `json:"Id,omitempty"`
Name string `json:"Name,omitempty"`
Priority int `json:"Priority,omitempty"`
Disabled bool `json:"Disabled,omitempty"`
}
SyncGroup represents a synchronization group for an asset account
type Tag ¶
type Tag struct {
Id int `json:"Id,omitempty"`
Name string `json:"Name,omitempty"`
Description string `json:"Description,omitempty"`
AdminAssigned bool `json:"AdminAssigned,omitempty"`
}
Tag represents metadata that can be attached to an asset account for organization and filtering purposes.
type TaggingGroupingCondition ¶
type TaggingGroupingCondition struct {
ObjectAttribute string `json:"ObjectAttribute"`
CompareType string `json:"CompareType"`
CompareValue string `json:"CompareValue"`
}
TaggingGroupingCondition represents a single condition for grouping
type TaskNames ¶
type TaskNames string
TaskNames defines the supported task names for account tasks
const ( Archive TaskNames = "Archive" ChangeApiKey TaskNames = "ChangeApiKey" ChangeFile TaskNames = "ChangeFile" ChangePassword TaskNames = "ChangePassword" ChangeSshKey TaskNames = "ChangeSshKey" CheckApiKey TaskNames = "CheckApiKey" CheckFile TaskNames = "CheckFile" CheckPassword TaskNames = "CheckPassword" CheckSshKey TaskNames = "CheckSshKey" DemoteAccount TaskNames = "DemoteAccount" DirectoryAssetDeleteSync TaskNames = "DirectoryAssetDeleteSync" DirectoryAssetSync TaskNames = "DirectoryAssetSync" DirectoryProviderDeleteSync TaskNames = "DirectoryProviderDeleteSync" DirectoryProviderSync TaskNames = "DirectoryProviderSync" DiscoverAccounts TaskNames = "DiscoverAccounts" DiscoverAssets TaskNames = "DiscoverAssets" DiscoverServices TaskNames = "DiscoverServices" DiscoverSshHostKey TaskNames = "DiscoverSshHostKey" DiscoverSshKeys TaskNames = "DiscoverSshKeys" ElevateAccount TaskNames = "ElevateAccount" InstallSshKey TaskNames = "InstallSshKey" LocalIdentityProviderSync TaskNames = "LocalIdentityProviderSync" PasswordSyncAccounts TaskNames = "PasswordSyncAccounts" RestoreAccount TaskNames = "RestoreAccount" RetrieveSshHostKey TaskNames = "RetrieveSshHostKey" RevokeSshKey TaskNames = "RevokeSshKey" SshKeySyncAccounts TaskNames = "SshKeySyncAccounts" SuspendAccount TaskNames = "SuspendAccount" TestConnection TaskNames = "TestConnection" UnknownTask TaskNames = "Unknown" UpdateDependentAsset TaskNames = "UpdateDependentAsset" )
type TaskProperties ¶
type TaskProperties struct {
HasAccountTaskFailure bool `json:"HasAccountTaskFailure,omitempty"`
LastPasswordCheckDate time.Time `json:"LastPasswordCheckDate,omitempty"`
LastSuccessPasswordCheckDate time.Time `json:"LastSuccessPasswordCheckDate,omitempty"`
LastFailurePasswordCheckDate time.Time `json:"LastFailurePasswordCheckDate,omitempty"`
LastPasswordCheckTaskId string `json:"LastPasswordCheckTaskId,omitempty"`
FailedPasswordCheckAttempts int `json:"FailedPasswordCheckAttempts,omitempty"`
NextPasswordCheckDate time.Time `json:"NextPasswordCheckDate,omitempty"`
LastPasswordChangeDate time.Time `json:"LastPasswordChangeDate,omitempty"`
LastSuccessPasswordChangeDate time.Time `json:"LastSuccessPasswordChangeDate,omitempty"`
LastFailurePasswordChangeDate time.Time `json:"LastFailurePasswordChangeDate,omitempty"`
LastPasswordChangeTaskId string `json:"LastPasswordChangeTaskId,omitempty"`
FailedPasswordChangeAttempts int `json:"FailedPasswordChangeAttempts,omitempty"`
NextPasswordChangeDate time.Time `json:"NextPasswordChangeDate,omitempty"`
LastSshKeyCheckDate time.Time `json:"LastSshKeyCheckDate,omitempty"`
LastSuccessSshKeyCheckDate time.Time `json:"LastSuccessSshKeyCheckDate,omitempty"`
LastFailureSshKeyCheckDate time.Time `json:"LastFailureSshKeyCheckDate,omitempty"`
LastSshKeyCheckTaskId string `json:"LastSshKeyCheckTaskId,omitempty"`
FailedSshKeyCheckAttempts int `json:"FailedSshKeyCheckAttempts,omitempty"`
NextSshKeyCheckDate time.Time `json:"NextSshKeyCheckDate,omitempty"`
LastSshKeyChangeDate time.Time `json:"LastSshKeyChangeDate,omitempty"`
LastSuccessSshKeyChangeDate time.Time `json:"LastSuccessSshKeyChangeDate,omitempty"`
LastFailureSshKeyChangeDate time.Time `json:"LastFailureSshKeyChangeDate,omitempty"`
LastSshKeyChangeTaskId string `json:"LastSshKeyChangeTaskId,omitempty"`
FailedSshKeyChangeAttempts int `json:"FailedSshKeyChangeAttempts,omitempty"`
NextSshKeyChangeDate time.Time `json:"NextSshKeyChangeDate,omitempty"`
LastSshKeyDiscoveryDate time.Time `json:"LastSshKeyDiscoveryDate,omitempty"`
LastSuccessSshKeyDiscoveryDate time.Time `json:"LastSuccessSshKeyDiscoveryDate,omitempty"`
LastFailureSshKeyDiscoveryDate time.Time `json:"LastFailureSshKeyDiscoveryDate,omitempty"`
LastSshKeyDiscoveryTaskId string `json:"LastSshKeyDiscoveryTaskId,omitempty"`
FailedSshKeyDiscoveryAttempts int `json:"FailedSshKeyDiscoveryAttempts,omitempty"`
NextSshKeyDiscoveryDate time.Time `json:"NextSshKeyDiscoveryDate,omitempty"`
LastSshKeyRevokeDate time.Time `json:"LastSshKeyRevokeDate,omitempty"`
LastSuccessSshKeyRevokeDate time.Time `json:"LastSuccessSshKeyRevokeDate,omitempty"`
LastFailureSshKeyRevokeDate time.Time `json:"LastFailureSshKeyRevokeDate,omitempty"`
LastSshKeyRevokeTaskId string `json:"LastSshKeyRevokeTaskId,omitempty"`
FailedSshKeyRevokeAttempts int `json:"FailedSshKeyRevokeAttempts,omitempty"`
LastSuspendAccountDate time.Time `json:"LastSuspendAccountDate,omitempty"`
LastSuccessSuspendAccountDate time.Time `json:"LastSuccessSuspendAccountDate,omitempty"`
LastFailureSuspendAccountDate time.Time `json:"LastFailureSuspendAccountDate,omitempty"`
LastSuspendAccountTaskId string `json:"LastSuspendAccountTaskId,omitempty"`
FailedSuspendAccountAttempts int `json:"FailedSuspendAccountAttempts,omitempty"`
NextSuspendAccountDate time.Time `json:"NextSuspendAccountDate,omitempty"`
LastRestoreAccountDate time.Time `json:"LastRestoreAccountDate,omitempty"`
LastSuccessRestoreAccountDate time.Time `json:"LastSuccessRestoreAccountDate,omitempty"`
LastFailureRestoreAccountDate time.Time `json:"LastFailureRestoreAccountDate,omitempty"`
LastRestoreAccountTaskId string `json:"LastRestoreAccountTaskId,omitempty"`
FailedRestoreAccountAttempts int `json:"FailedRestoreAccountAttempts,omitempty"`
NextRestoreAccountDate time.Time `json:"NextRestoreAccountDate,omitempty"`
FailedApiKeyCheckAttempts int `json:"FailedApiKeyCheckAttempts,omitempty"`
FailedApiKeyChangeAttempts int `json:"FailedApiKeyChangeAttempts,omitempty"`
LastFileCheckDate time.Time `json:"LastFileCheckDate,omitempty"`
LastSuccessFileCheckDate time.Time `json:"LastSuccessFileCheckDate,omitempty"`
LastFailureFileCheckDate time.Time `json:"LastFailureFileCheckDate,omitempty"`
LastFileCheckTaskId string `json:"LastFileCheckTaskId,omitempty"`
FailedFileCheckAttempts int `json:"FailedFileCheckAttempts,omitempty"`
LastFileChangeDate time.Time `json:"LastFileChangeDate,omitempty"`
LastSuccessFileChangeDate time.Time `json:"LastSuccessFileChangeDate,omitempty"`
LastFailureFileChangeDate time.Time `json:"LastFailureFileChangeDate,omitempty"`
LastFileChangeTaskId time.Time `json:"LastFileChangeTaskId,omitempty"`
FailedFileChangeAttempts int `json:"FailedFileChangeAttempts,omitempty"`
LastDemoteAccountDate time.Time `json:"LastDemoteAccountDate,omitempty"`
LastSuccessDemoteAccountDate time.Time `json:"LastSuccessDemoteAccountDate,omitempty"`
LastFailureDemoteAccountDate time.Time `json:"LastFailureDemoteAccountDate,omitempty"`
LastDemoteAccountTaskId string `json:"LastDemoteAccountTaskId,omitempty"`
FailedDemoteAccountAttempts int `json:"FailedDemoteAccountAttempts,omitempty"`
NextDemoteAccountDate time.Time `json:"NextDemoteAccountDate,omitempty"`
LastElevateAccountDate time.Time `json:"LastElevateAccountDate,omitempty"`
LastSuccessElevateAccountDate time.Time `json:"LastSuccessElevateAccountDate,omitempty"`
LastFailureElevateAccountDate time.Time `json:"LastFailureElevateAccountDate,omitempty"`
LastElevateAccountTaskId string `json:"LastElevateAccountTaskId,omitempty"`
FailedElevateAccountAttempts int `json:"FailedElevateAccountAttempts,omitempty"`
NextElevateAccountDate time.Time `json:"NextElevateAccountDate,omitempty"`
}
TaskProperties represents task properties for an asset account
type TimeOfDayInterval ¶
type TimeOfDayInterval struct {
StartHour int `json:"StartHour"`
StartMinute int `json:"StartMinute"`
EndHour int `json:"EndHour"`
EndMinute int `json:"EndMinute"`
Iterations int `json:"Iterations"`
}
TimeOfDayInterval represents a time interval configuration
type TypeReferenceName ¶
type TypeReferenceName string
TypeReferenceName represents the type of identity provider
const ( TypeUnknown TypeReferenceName = "Unknown" TypeLocal TypeReferenceName = "Local" TypeCertificate TypeReferenceName = "Certificate" TypeActiveDirectory TypeReferenceName = "ActiveDirectory" TypeRadius TypeReferenceName = "Radius" TypeRadiusAsPrimary TypeReferenceName = "RadiusAsPrimary" TypeLdap TypeReferenceName = "Ldap" TypeExternalFederation TypeReferenceName = "ExternalFederation" TypeFido2 TypeReferenceName = "Fido2" TypeOtherDirectory TypeReferenceName = "OtherDirectory" TypeStarlingDirectory TypeReferenceName = "StarlingDirectory" TypeOneLoginMfa TypeReferenceName = "OneLoginMfa" TypeScim TypeReferenceName = "Scim" )
type User ¶
type User struct {
Name string `json:"Name,omitempty"`
PrimaryAuthenticationProvider AuthenticationProvider `json:"PrimaryAuthenticationProvider,omitempty"`
Preferences []Preference `json:"Preferences,omitempty"`
Fido2Authenticators []Fido2Authenticator `json:"Fido2Authenticators,omitempty"`
AdminRoles []string `json:"AdminRoles,omitempty"`
Id int `json:"Id,omitempty"`
Description string `json:"Description,omitempty"`
DisplayName string `json:"DisplayName,omitempty"`
LastName string `json:"LastName,omitempty"`
FirstName string `json:"FirstName,omitempty"`
EmailAddress string `json:"EmailAddress,omitempty"`
WorkPhone string `json:"WorkPhone,omitempty"`
MobilePhone string `json:"MobilePhone,omitempty"`
SecondaryAuthenticationProvider AuthenticationProvider `json:"SecondaryAuthenticationProvider,omitempty"`
IdentityProvider IdentityProvider `json:"IdentityProvider,omitempty"`
Disabled bool `json:"Disabled,omitempty"`
TimeZoneId string `json:"TimeZoneId,omitempty"`
TimeZoneDisplayName string `json:"TimeZoneDisplayName,omitempty"`
TimeZoneIanaName string `json:"TimeZoneIanaName,omitempty"`
IsPartitionOwner bool `json:"IsPartitionOwner,omitempty"`
DirectoryProperties DirectoryProperties `json:"DirectoryProperties,omitempty"`
CloudAssistantApproveEnabled bool `json:"CloudAssistantApproveEnabled,omitempty"`
CloudAssistantRecipientId string `json:"CloudAssistantRecipientId,omitempty"`
AllowPersonalAccounts bool `json:"AllowPersonalAccounts,omitempty"`
Locked bool `json:"Locked,omitempty"`
PasswordNeverExpires bool `json:"PasswordNeverExpires,omitempty"`
ChangePasswordAtNextLogin bool `json:"ChangePasswordAtNextLogin,omitempty"`
Base64PhotoData string `json:"Base64PhotoData,omitempty"`
IsSystemOwned bool `json:"IsSystemOwned,omitempty"`
IsRequester bool `json:"IsRequester,omitempty"`
IsApprover bool `json:"IsApprover,omitempty"`
IsReviewer bool `json:"IsReviewer,omitempty"`
LastLoginDate time.Time `json:"LastLoginDate,omitempty"`
LastRequestDate time.Time `json:"LastRequestDate,omitempty"`
CreatedDate time.Time `json:"CreatedDate,omitempty"`
CreatedByUserId int `json:"CreatedByUserId,omitempty"`
CreatedByUserDisplayName string `json:"CreatedByUserDisplayName,omitempty"`
ModifiedDate time.Time `json:"ModifiedDate,omitempty"`
ModifiedByUserId int `json:"ModifiedByUserId,omitempty"`
ModifiedByUserDisplayName string `json:"ModifiedByUserDisplayName,omitempty"`
RequireCertificateAuthentication bool `json:"RequireCertificateAuthentication,omitempty"`
DirectoryRequireCertificateAuthentication bool `json:"DirectoryRequireCertificateAuthentication,omitempty"`
LinkedAccountsCount int `json:"LinkedAccountsCount,omitempty"`
// contains filtered or unexported fields
}
func (User) AddLinkedAccounts ¶
func (u User) AddLinkedAccounts(policyAccount []PolicyAccount) ([]PolicyAccount, error)
AddLinkedAccounts adds policy accounts to this user's linked accounts.
This method is a convenience wrapper around AddLinkedAccounts that uses the current user instance.
Example:
accounts := []PolicyAccount{{Id: 123}}
linked, err := user.AddLinkedAccounts(accounts)
Parameters:
- policyAccount: A slice of policy accounts to link
Returns:
- []PolicyAccount: The linked policy accounts
- error: An error if the operation fails, nil otherwise
func (*User) Delete ¶
Delete removes this user from Safeguard.
This method is a convenience wrapper around DeleteUser that uses the current user's ID.
Example:
err := user.Delete()
Returns:
- error: An error if the deletion fails, nil otherwise
func (User) GetGroups ¶
GetGroups retrieves the groups that this user belongs to.
This method is a convenience wrapper around GetGroups that uses the current user's ID.
Example:
groups, err := user.GetGroups()
Returns:
- []UserGroup: A slice of user groups
- error: An error if the request fails, nil otherwise
func (User) GetLinkedAccounts ¶
func (u User) GetLinkedAccounts() ([]PolicyAccount, error)
GetLinkedAccounts retrieves the policy accounts linked to this user.
This method is a convenience wrapper around GetLinkedAccounts that uses the current user's ID.
Example:
accounts, err := user.GetLinkedAccounts()
Returns:
- []PolicyAccount: A slice of linked policy accounts
- error: An error if the request fails, nil otherwise
func (User) GetPreferences ¶
func (u User) GetPreferences() ([]Preference, error)
GetPreferences retrieves the preferences for this user.
This method is a convenience wrapper around GetUserPreferences that uses the current user's ID.
Example:
prefs, err := user.GetPreferences()
Returns:
- []Preference: A slice of user preferences
- error: An error if the request fails, nil otherwise
func (User) GetRoles ¶
GetRoles retrieves the roles assigned to this user.
This method is a convenience wrapper around GetUserRoles that uses the current user's ID.
Example:
roles, err := user.GetRoles()
Returns:
- []Role: A slice of assigned roles
- error: An error if the request fails, nil otherwise
func (User) RemoveLinkedAccounts ¶
func (u User) RemoveLinkedAccounts(policyAccount []PolicyAccount) ([]PolicyAccount, error)
RemoveLinkedAccounts removes policy accounts from this user's linked accounts.
This method is a convenience wrapper around RemoveLinkedAccounts that uses the current user instance.
Example:
accounts := []PolicyAccount{{Id: 123}}
removed, err := user.RemoveLinkedAccounts(accounts)
Parameters:
- policyAccount: A slice of policy accounts to unlink
Returns:
- []PolicyAccount: The unlinked policy accounts
- error: An error if the operation fails, nil otherwise
func (User) SetAuthenticationProvider ¶
func (u User) SetAuthenticationProvider(authProvider AuthenticationProvider) (User, error)
SetAuthenticationProvider updates the primary authentication provider for this user.
This method updates the user's primary authentication method and saves the changes to Safeguard.
Example:
provider := AuthenticationProvider{Id: 123}
updated, err := user.SetAuthenticationProvider(provider)
Parameters:
- authProvider: The new authentication provider to set
Returns:
- User: The updated user object
- error: An error if the update fails, nil otherwise
func (User) SetClient ¶
func (a User) SetClient(c *SafeguardClient) any
func (User) ToJson ¶
ToJson converts a User object to its JSON string representation.
This method serializes all fields of the User object into a JSON-formatted string. Empty or zero-valued fields are included in the output.
Example:
user := User{
Name: "John Smith",
EmailAddress: "john.smith@example.com"
}
json, err := user.ToJson()
Returns:
- string: JSON representation of the user
- error: An error if marshaling fails, nil otherwise
type UserGroup ¶
type UserGroup struct {
Id int `json:"Id"`
Name string `json:"Name"`
Description string `json:"Description"`
IdentityProvider GroupIdentityProvider `json:"IdentityProvider"`
IsReadOnly bool `json:"IsReadOnly"`
CreatedDate time.Time `json:"CreatedDate"`
CreatedByUserId int `json:"CreatedByUserId"`
CreatedByUserDisplayName string `json:"CreatedByUserDisplayName"`
ModifiedDate time.Time `json:"ModifiedDate"`
ModifiedByUserId int `json:"ModifiedByUserId"`
ModifiedByUserDisplayName string `json:"ModifiedByUserDisplayName"`
DirectoryProperties DirectoryProperties `json:"DirectoryProperties"`
Members []UserGroupMember `json:"Members"`
DirectoryGroupSyncProperties DirectoryGroupSyncProperties `json:"DirectoryGroupSyncProperties"`
// contains filtered or unexported fields
}
UserGroup represents a group of users in Safeguard with associated properties and memberships
func (UserGroup) SetClient ¶
func (a UserGroup) SetClient(c *SafeguardClient) any
func (UserGroup) ToJson ¶
ToJson serializes a UserGroup object into a JSON string.
This method converts the UserGroup instance into a JSON-formatted string, including all defined fields. Empty or zero-valued fields are included in the output.
Example:
group := UserGroup{
Name: "Administrators",
Description: "System administrators group"
}
json, err := group.ToJson()
Returns:
- string: A JSON representation of the UserGroup object
- error: An error if JSON marshaling fails, nil otherwise
type UserGroupDirectoryProperties ¶
type UserGroupDirectoryProperties struct {
DirectoryId int `json:"DirectoryId"`
DirectoryName string `json:"DirectoryName"`
DomainName string `json:"DomainName"`
NetbiosName string `json:"NetbiosName"`
DistinguishedName string `json:"DistinguishedName"`
ObjectGuid string `json:"ObjectGuid"`
ObjectSid string `json:"ObjectSid"`
}
DirectoryProperties represents directory-specific properties for a group or user
type UserGroupMember ¶
type UserGroupMember struct {
AdminRoles []string `json:"AdminRoles"`
Id int `json:"Id"`
Name string `json:"Name"`
Description string `json:"Description"`
DisplayName string `json:"DisplayName"`
LastName string `json:"LastName"`
FirstName string `json:"FirstName"`
EmailAddress string `json:"EmailAddress"`
WorkPhone string `json:"WorkPhone"`
MobilePhone string `json:"MobilePhone"`
PrimaryAuthenticationProvider AuthenticationProvider `json:"PrimaryAuthenticationProvider"`
SecondaryAuthenticationProvider AuthenticationProvider `json:"SecondaryAuthenticationProvider"`
IdentityProvider GroupIdentityProvider `json:"IdentityProvider"`
Disabled bool `json:"Disabled"`
TimeZoneId string `json:"TimeZoneId"`
TimeZoneDisplayName string `json:"TimeZoneDisplayName"`
TimeZoneIanaName string `json:"TimeZoneIanaName"`
IsPartitionOwner bool `json:"IsPartitionOwner"`
DirectoryProperties DirectoryProperties `json:"DirectoryProperties"`
CloudAssistantApproveEnabled bool `json:"CloudAssistantApproveEnabled"`
CloudAssistantRecipientId string `json:"CloudAssistantRecipientId"`
AllowPersonalAccounts bool `json:"AllowPersonalAccounts"`
Locked bool `json:"Locked"`
PasswordNeverExpires bool `json:"PasswordNeverExpires"`
ChangePasswordAtNextLogin bool `json:"ChangePasswordAtNextLogin"`
Base64PhotoData string `json:"Base64PhotoData"`
IsSystemOwned bool `json:"IsSystemOwned"`
IsRequester bool `json:"IsRequester"`
IsApprover bool `json:"IsApprover"`
IsReviewer bool `json:"IsReviewer"`
LastLoginDate time.Time `json:"LastLoginDate"`
LastRequestDate time.Time `json:"LastRequestDate"`
CreatedDate time.Time `json:"CreatedDate"`
CreatedByUserId int `json:"CreatedByUserId"`
CreatedByUserDisplayName string `json:"CreatedByUserDisplayName"`
ModifiedDate time.Time `json:"ModifiedDate"`
ModifiedByUserId int `json:"ModifiedByUserId"`
ModifiedByUserDisplayName string `json:"ModifiedByUserDisplayName"`
RequireCertificateAuthentication bool `json:"RequireCertificateAuthentication"`
DirectoryRequireCertificateAuthentication bool `json:"DirectoryRequireCertificateAuthentication"`
LinkedAccountsCount int `json:"LinkedAccountsCount"`
}
UserGroupMember represents a user that belongs to a Safeguard user group, including their roles and authentication configuration
type UserInfo ¶
type UserInfo struct {
DisplayName string `json:"DisplayName,omitempty"`
Id int `json:"Id,omitempty"`
IdentityProviderId int `json:"IdentityProviderId,omitempty"`
IdentityProviderName string `json:"IdentityProviderName,omitempty"`
IdentityProviderTypeReferenceName string `json:"IdentityProviderTypeReferenceName,omitempty"`
IsSystemOwned bool `json:"IsSystemOwned,omitempty"`
Name string `json:"Name,omitempty"`
PrincipalKind string `json:"PrincipalKind,omitempty"`
EmailAddress *string `json:"EmailAddress,omitempty"`
DomainName *string `json:"DomainName,omitempty"`
FullDisplayName string `json:"FullDisplayName,omitempty"`
}
UserInfo represents information about a user that performed an action
type UserLogProperties ¶
type UserLogProperties struct {
ClientIpAddress string `json:"ClientIpAddress,omitempty"`
UserName string `json:"UserName,omitempty"`
DomainName string `json:"DomainName,omitempty"`
UserDisplayName string `json:"UserDisplayName,omitempty"`
UserWasGlobalAdmin bool `json:"UserWasGlobalAdmin,omitempty"`
UserWasDirectoryAdmin bool `json:"UserWasDirectoryAdmin,omitempty"`
UserWasAuditor bool `json:"UserWasAuditor,omitempty"`
UserWasApplicationAuditor bool `json:"UserWasApplicationAuditor,omitempty"`
UserWasSystemAuditor bool `json:"UserWasSystemAuditor,omitempty"`
UserWasAssetAdmin bool `json:"UserWasAssetAdmin,omitempty"`
UserWasPartitionOwner bool `json:"UserWasPartitionOwner,omitempty"`
UserWasApplianceAdmin bool `json:"UserWasApplianceAdmin,omitempty"`
UserWasPolicyAdmin bool `json:"UserWasPolicyAdmin,omitempty"`
UserWasUserAdmin bool `json:"UserWasUserAdmin,omitempty"`
UserWasHelpdeskAdmin bool `json:"UserWasHelpdeskAdmin,omitempty"`
UserWasOperationsAdmin bool `json:"UserWasOperationsAdmin,omitempty"`
}
UserLogProperties represents the user properties in a log entry including permissions, IP address, and user identification information
type UserProperties ¶
type UserProperties struct {
UserClassType []string `json:"UserClassType,omitempty"`
UserNameAttribute string `json:"UserNameAttribute,omitempty"`
FirstNameAttribute string `json:"FirstNameAttribute,omitempty"`
LastNameAttribute string `json:"LastNameAttribute,omitempty"`
DescriptionAttribute string `json:"DescriptionAttribute,omitempty"`
MailAttribute string `json:"MailAttribute,omitempty"`
PhoneAttribute string `json:"PhoneAttribute,omitempty"`
MobileAttribute string `json:"MobileAttribute,omitempty"`
DirectoryGroupSyncAttributeForExternalFederationAuthentication string `json:"DirectoryGroupSyncAttributeForExternalFederationAuthentication,omitempty"`
DirectoryGroupSyncAttributeForRadiusAuthentication string `json:"DirectoryGroupSyncAttributeForRadiusAuthentication,omitempty"`
DirectoryGroupSyncAttributeForManagedObjects string `json:"DirectoryGroupSyncAttributeForManagedObjects,omitempty"`
}
type UserSchemaProperties ¶
type UserSchemaProperties struct {
UserClassType []string `json:"UserClassType,omitempty"`
UserNameAttribute string `json:"UserNameAttribute,omitempty"`
PasswordAttribute string `json:"PasswordAttribute,omitempty"`
DescriptionAttribute string `json:"DescriptionAttribute,omitempty"`
MemberOfAttribute string `json:"MemberOfAttribute,omitempty"`
AltLoginNameAttribute string `json:"AltLoginNameAttribute,omitempty"`
}
UserSchemaProperties represents directory attribute mappings for users
type UserTemplate ¶
type UserTemplate struct {
PrimaryAuthenticationProviderId int `json:"PrimaryAuthenticationProviderId,omitempty"`
PrimaryAuthenticationProviderType string `json:"PrimaryAuthenticationProviderTypeReferenceName,omitempty"`
PrimaryAuthenticationProviderName string `json:"PrimaryAuthenticationProviderName,omitempty"`
RequireCertificateAuthentication bool `json:"RequireCertificateAuthentication,omitempty"`
SecondaryAuthenticationProviderId int `json:"SecondaryAuthenticationProviderId,omitempty"`
SecondaryAuthenticationProviderType string `json:"SecondaryAuthenticationProviderTypeReferenceName,omitempty"`
SecondaryAuthenticationProviderName string `json:"SecondaryAuthenticationProviderName,omitempty"`
AllowPersonalAccounts bool `json:"AllowPersonalAccounts,omitempty"`
AdminRoles []string `json:"AdminRoles,omitempty"`
}
type WorkflowAction ¶
type WorkflowAction struct {
ActionType string `json:"ActionType,omitempty"`
Comment *string `json:"Comment,omitempty"`
NewState string `json:"NewState,omitempty"`
OccurredOn time.Time `json:"OccurredOn,omitempty"`
OldState string `json:"OldState,omitempty"`
User UserInfo `json:"User,omitempty"`
SessionId *string `json:"SessionId,omitempty"`
}
WorkflowAction represents an action taken to modify an access request
Source Files
¶
- accessPolicies.go
- accessRequest.go
- activityLog.go
- assetAccount.go
- assetGroups.go
- assetPartition.go
- assets.go
- authProvider.go
- authentication.go
- client.go
- cluster.go
- directoryServiceEntry.go
- fido2Auth.go
- filter.go
- identities.go
- idp.go
- me.go
- pkcs12.go
- policyAccount.go
- policyAsset.go
- preference.go
- reports.go
- request.go
- roles.go
- signalr.go
- userGroups.go
- users.go
- utils.go