Documentation ¶
Overview ¶
Copyright 2024 BeyondTrust. All rights reserved. utils responsible for utility functions.
Copyright 2024 BeyondTrust. All rights reserved. Package utils implements inputs validations
Index ¶
- func GetPFXContent(clientCertificatePath string, clientCertificateName string, ...) (string, string, error)
- func ValidateCreateFolderInput(folderDetails entities.FolderDetails) (entities.FolderDetails, error)
- func ValidateCreateManagedAccountInput(accountDetails entities.AccountDetails) (entities.AccountDetails, error)
- func ValidateCreateSecretInput(secretDetails interface{}) (interface{}, error)
- func ValidateInputs(params ValidationParams) error
- func ValidatePaths(secretPaths []string, isManagedAccount bool, separator string, ...) []string
- func ValidateURL(apiUrl string) error
- type HttpClientObj
- func (client *HttpClientObj) CallSecretSafeAPI(url string, httpMethod string, body bytes.Buffer, method string, ...) (io.ReadCloser, int, error, error)
- func (client *HttpClientObj) CreateMultiPartRequest(url, fileName string, metadata []byte, fileContent string) (io.ReadCloser, error)
- func (client *HttpClientObj) HttpRequest(url string, method string, body bytes.Buffer, accesToken string, apiKey string, ...) (closer io.ReadCloser, scode int, technicalError error, businessError error)
- type UserInputValidaton
- type ValidationParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPFXContent ¶ added in v0.7.0
func ValidateCreateFolderInput ¶ added in v0.11.0
func ValidateCreateFolderInput(folderDetails entities.FolderDetails) (entities.FolderDetails, error)
ValidateCreateFolderInput responsible for validating folder input.
func ValidateCreateManagedAccountInput ¶ added in v0.8.4
func ValidateCreateManagedAccountInput(accountDetails entities.AccountDetails) (entities.AccountDetails, error)
ValidateCreateManagedAccountInput responsible for validating Managed Account input
func ValidateCreateSecretInput ¶ added in v0.10.0
func ValidateCreateSecretInput(secretDetails interface{}) (interface{}, error)
ValidateCreateSecretInput responsible for validating secret input.
func ValidateInputs ¶
func ValidateInputs(params ValidationParams) error
ValidateInputs is responsible for validating end-user inputs.
func ValidatePaths ¶
func ValidatePaths(secretPaths []string, isManagedAccount bool, separator string, logger logging.Logger) []string
This method is responsbile for validating that the paths and names are valid.
func ValidateURL ¶
ValidateURL responsible for validating the Password Safe API URL.
Types ¶
type HttpClientObj ¶
HttpClientObj responsible for http request instance.
func GetHttpClient ¶
func GetHttpClient(clientTimeOut int, verifyCa bool, certificate string, certificate_key string, logger logging.Logger) (*HttpClientObj, error)
GetHttpClient is responsible for configuring an HTTP client and transport for API calls.
func (*HttpClientObj) CallSecretSafeAPI ¶
func (client *HttpClientObj) CallSecretSafeAPI(url string, httpMethod string, body bytes.Buffer, method string, accesToken string, apiKey string, contentType string) (io.ReadCloser, int, error, error)
CallSecretSafeAPI prepares http call
func (*HttpClientObj) CreateMultiPartRequest ¶ added in v0.10.0
func (client *HttpClientObj) CreateMultiPartRequest(url, fileName string, metadata []byte, fileContent string) (io.ReadCloser, error)
CreateMultipartRequest creates and sends multipart request.
func (*HttpClientObj) HttpRequest ¶
func (client *HttpClientObj) HttpRequest(url string, method string, body bytes.Buffer, accesToken string, apiKey string, contentType string) (closer io.ReadCloser, scode int, technicalError error, businessError error)
HttpRequest makes http request to the server.
type UserInputValidaton ¶
type UserInputValidaton struct { ApiKey string `validate:"omitempty,min=128,max=263"` ClientId string `validate:"omitempty,min=36,max=36,required_without=ApiKey"` ClientSecret string `validate:"omitempty,min=36,max=64,required_without=ApiKey"` ApiUrl string `validate:"required,http_url"` ClientTimeOutinSeconds int `validate:"gte=1,lte=300"` Separator string `validate:"required,min=1,max=1"` MaxFileSecretSizeBytes int `validate:"gte=1,lte=5000000"` }
UserInputValidaton responsible for input paramerter validation.