func()

in ecr-login/api/client.go [185:207]


func (c *defaultClient) ListCredentials() ([]*Auth, error) {
	// prime the cache with default authorization tokens
	_, err := c.GetCredentialsByRegistryID("")
	if err != nil {
		logrus.WithError(err).Debug("couldn't get authorization token for default registry")
	}
	_, err = c.GetPublicCredentials()
	if err != nil {
		logrus.WithError(err).Debug("couldn't get authorization token for public registry")
	}

	auths := make([]*Auth, 0)
	for _, authEntry := range c.credentialCache.List() {
		auth, err := extractToken(authEntry.AuthorizationToken, authEntry.ProxyEndpoint)
		if err != nil {
			logrus.WithError(err).Debug("Could not extract token")
		} else {
			auths = append(auths, auth)
		}
	}

	return auths, nil
}