Sha256: 590e6620412202ef4539c7a0a72be8f0dba1dae041b48d32bcd63bd971979f41

Contents?: true

Size: 1.14 KB

Versions: 18

Compression:

Stored size: 1.14 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::Integer => Types::Strict::Array.meta(omittable: true),
    )

    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

18 entries across 18 versions & 1 rubygems

Version Path
aws_assume_role-1.2.3-universal-freebsd lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.3-universal-darwin lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.3-universal-linux lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.3-universal-openbsd lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.3 lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.3-linux lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.2-universal-darwin lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.2-universal-linux lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.2-linux lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.2-universal-openbsd lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.2-universal-freebsd lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.2 lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.1 lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.1-linux lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.1-universal-openbsd lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.1-universal-darwin lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.1-universal-freebsd lib/aws_assume_role/credentials/factories/repository.rb
aws_assume_role-1.2.1-universal-linux lib/aws_assume_role/credentials/factories/repository.rb