agent/ecr/factory.go
func getClientConfig(httpClient *http.Client, authData *apicontainer.ECRAuthData) (*aws.Config, error) {
	cfg := aws.NewConfig().WithRegion(authData.Region).WithHTTPClient(httpClient)
	if authData.EndpointOverride != "" {
		cfg.Endpoint = aws.String(authData.EndpointOverride)
	}

	if authData.UseExecutionRole {
		if authData.GetPullCredentials() == (credentials.IAMRoleCredentials{}) {
			return nil, fmt.Errorf("container uses execution credentials, but the credentials are empty")
		}
		creds := awscreds.NewStaticCredentials(authData.GetPullCredentials().AccessKeyID,
			authData.GetPullCredentials().SecretAccessKey,
			authData.GetPullCredentials().SessionToken)
		cfg = cfg.WithCredentials(creds)
	}

	return cfg, nil
}
func getClientConfig(httpClient *http.Client, authData *apicontainer.ECRAuthData) (*aws.Config, error) {
	cfg := aws.NewConfig().WithRegion(authData.Region).WithHTTPClient(httpClient)
	if authData.EndpointOverride != "" {
		cfg.Endpoint = aws.String(authData.EndpointOverride)
	}

	if authData.UseExecutionRole {
		if authData.GetPullCredentials() == (credentials.IAMRoleCredentials{}) {
			return nil, fmt.Errorf("container uses execution credentials, but the credentials are empty")
		}
		creds := awscreds.NewStaticCredentials(authData.GetPullCredentials().AccessKeyID,
			authData.GetPullCredentials().SecretAccessKey,
			authData.GetPullCredentials().SessionToken)
		cfg = cfg.WithCredentials(creds)
	}

	return cfg, nil
}
func getClientConfig ( httpClient * http . Client , authData * apicontainer . ECRAuthData ) ( * aws . Config , error ) { cfg := aws . NewConfig ( ) . WithRegion ( authData . Region ) . WithHTTPClient ( httpClient ) if authData . EndpointOverride != " " { cfg . Endpoint = aws . String ( authData . EndpointOverride ) } if authData . UseExecutionRole { if authData . GetPullCredentials ( ) == ( credentials . IAMRoleCredentials { } ) { return nil , fmt . Errorf ( " " ) } creds := awscreds . NewStaticCredentials ( authData . GetPullCredentials ( ) . AccessKeyID , authData . GetPullCredentials ( ) . SecretAccessKey , authData . GetPullCredentials ( ) . SessionToken ) cfg = cfg . WithCredentials ( creds ) } return cfg , nil }
// getClientConfig returns the config for the ecr client based on authData
getClientConfig returns the config for the ecr client based on authData