Documentation ¶
Index ¶
- func DecryptStringWithRsaKey(encryptedBase64 string, keyFile string) (*string, error)
- func EncryptStringWithRsaKey(plaintext string, keyFile string) (*string, error)
- func GetCollections(cfg RdrGatewayConfig, ctype, project string) ([]string, error)
- func GetDacOfProject(number string) string
- func GetOAuth2Token(clientID, clientSecret, authURL string, scopes []string) (*oauth2.Token, error)
- func NewHTTPSClient(timeout time.Duration, insecure bool) (client *http.Client)
- func OAuth2HttpClient(ctx context.Context, clientID, clientSecret, authURL string, scopes []string) (*http.Client, error)
- func SetDacCache(dacs map[string]string)
- func UnmarshalFromResponseBody(response *http.Response, i interface{}) error
- func UpdatePpmDacs(ctx context.Context, cfg PpmFormConfig, every time.Duration, ...)
- type PpmFormConfig
- type PpmProjectCollection
- type RdrGatewayConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptStringWithRsaKey ¶
DecryptStringWithRsaKey decrypts the encrypted string encoded in base64 standard encoding, and returns the decrypted string.
func EncryptStringWithRsaKey ¶
EncryptStringWithRsaKey encrypts the `plaintext` with the asymetric key, and returns the encrypted data represented in the base64 standard encoding.
func GetCollections ¶
func GetCollections(cfg RdrGatewayConfig, ctype, project string) ([]string, error)
GetCollections return a list of collName of the RDR collections with type `ctype` and associated with project number `project`.
func GetDacOfProject ¶
GetDacOfProject returns the corresponding DAC of the project `number` from the internal cache.
func GetOAuth2Token ¶
func NewHTTPSClient ¶
NewHTTPSClient initiates a new HTTPS client with timeout and skip certificate verification when `insecure` flag is set to `true`.
func OAuth2HttpClient ¶
func OAuth2HttpClient(ctx context.Context, clientID, clientSecret, authURL string, scopes []string) (*http.Client, error)
OAuth2HttpClient returns a HTTP client wrapped with HTTP round tripper for Oauth token. It has lifetime within the `ctx`.
func SetDacCache ¶
func UnmarshalFromResponseBody ¶
UnmarshalFromResponseBody unmarshals data from the `response.Body` stream into a struct `i`. The `response.Body` is also closed after calling this function.
func UpdatePpmDacs ¶
func UpdatePpmDacs( ctx context.Context, cfg PpmFormConfig, every time.Duration, sdacs map[string]string, )
UpdatePpmDacs runs an blocking loop within the lifetime of the context. For `every` duration in this loop, it updates the internal cache for DACs of the DCC OU registered in the online PPM form.
A list of static DACs `sdacs` will take precedence over the DACs retrieved from the online PPM form.
Types ¶
type PpmFormConfig ¶
type PpmProjectCollection ¶
type RdrGatewayConfig ¶
type RdrGatewayConfig struct {
ApiEndpoint string
}