utils

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 13 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

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

func ValidateURL(apiUrl string) error

ValidateURL responsible for validating the Password Safe API URL.

Types

type HttpClientObj

type HttpClientObj struct {
	HttpClient *http.Client
	// contains filtered or unexported fields
}

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) (io.ReadCloser, int, error, error)

CallSecretSafeAPI prepares http call

func (*HttpClientObj) HttpRequest

func (client *HttpClientObj) HttpRequest(url string, method string, body bytes.Buffer, accesToken string) (closer io.ReadCloser, scode int, technicalError error, businessError error)

HttpRequest makes http request to the server.

type UserInputValidaton

type UserInputValidaton struct {
	ClientId               string `validate:"required,min=36,max=36"`
	ClientSecret           string `validate:"required,min=36,max=64"`
	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.

type ValidationParams

type ValidationParams struct {
	ClientID                   string
	ClientSecret               string
	ApiUrl                     *string
	ClientTimeOutInSeconds     int
	Separator                  *string
	VerifyCa                   bool
	Logger                     logging.Logger
	Certificate                string
	CertificateKey             string
	RetryMaxElapsedTimeMinutes *int
	MaxFileSecretSizeBytes     *int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL