Sha256: 2f425638349362bff228cd8370a094c8120ce3985e17e95a5dc8e9d3defe1215

Contents?: true

Size: 1.1 KB

Versions: 19

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require_relative "includes"
require_relative "abstract_factory"

class AwsAssumeRole::Credentials::Factories::Repository
    include AwsAssumeRole::Credentials::Factories

    SubFactoryRepositoryType = Types::Hash.schema(Types::Coercible::Int => Types::Strict::Array)

    FactoryRepositoryType = Types::Hash.schema(
        credential_provider: SubFactoryRepositoryType,
        second_factor_provider: SubFactoryRepositoryType,
        instance_role_provider: SubFactoryRepositoryType,
    )

    def self.factories
        repository.keys.map { |t| [t, flatten_factory_type_list(t)] }.to_h
    end

    def self.repository
        @repository ||= FactoryRepositoryType[
            credential_provider: {},
            second_factor_provider: {},
            instance_role_provider: {},
        ]
    end

    def self.register_factory(klass, type, priority)
        repository[type][priority] ||= []
        repository[type][priority] << klass
    end

    def self.flatten_factory_type_list(type)
        repository[type].keys.sort.map { |x| @repository[type][x] }.flatten
    end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
aws_assume_role-1.1.1 lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.1.1-linux lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.1.1-universal-openbsd lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.1.1-universal-darwin lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.1.1-universal-freebsd lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.1.1-universal-linux lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.1.0-universal-openbsd lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.1.0-universal-darwin lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.1.0-universal-freebsd lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.1.0-universal-linux lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.0.6-linux lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.1.0-linux lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.0.6 lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.0.5 lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.0.4 lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.0.3 lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.0.2 lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.0.1 lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.0.0 lib/aws_assume_role/credentials/factories/repository.rb