Ejemplo n.º 1
0
// ReadIAM explicitly mutates the global shared conf.Vals state by reading in the IAM. Use
// this function at program startup or any time you need to force a refresh of the IAM
// credentials.
func ReadIAM(rf *roles_files.RolesFiles) error {
	roles_read_err := rf.RolesRead()
	if roles_read_err != nil {
		e := fmt.Sprintf("conf_iam.ReadIAM:cannot perform initial roles read: %s",
			roles_read_err.Error())
		return errors.New(e)
	}
	return AssignCredentials(rf)
}
Ejemplo n.º 2
0
// ReadIAMToConf will read the credentials data from rf and safely assign it to conf c.
func ReadIAMToConf(rf *roles_files.RolesFiles, c *conf.AWS_Conf) error {
	if rf == nil || c == nil {
		return errors.New("conf_iam.ReadIAMToConf: rf or c is nil")
	}
	roles_read_err := rf.RolesRead()
	if roles_read_err != nil {
		e := fmt.Sprintf("conf_iam.ReadIAM:cannot perform initial roles read: %s",
			roles_read_err.Error())
		return errors.New(e)
	}
	return AssignCredentialsToConf(rf, c)
}