Sha256: 32dc7c48a5c4d0d385935682105c5e8dcba4617b062c7878d84f27ef0037f9f8

Contents?: true

Size: 1.27 KB

Versions: 19

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

require_relative "includes"
module AwsAssumeRole
    module Types
        Dry = Dry::Types.module

        ::Dry::Types.register_class(::Aws::Credentials)
        AwsAssumeRole::Types::Credentials = ::Dry::Types["aws.credentials"]

        ACCESS_KEY_REGEX = /[\w]+/
        ACCESS_KEY_VALIDATOR = proc { filled? & str? & format?(ACCESS_KEY_REGEX) & min_size?(16) & max_size?(32) }
        ARN_REGEX = %r{arn:[\w+=\/,.@-]+:[\w+=\/,.@-]+:[\w+=\/,.@-]*:[0-9]+:[\w+=,.@-]+(\/[\w+=\/,.@-]+)*}
        EXTERNAL_ID_REGEX = %r{[\w+=,.@:\/-]*}
        MFA_REGEX = %r{arn:aws:iam::[0-9]+:mfa\/([\w+=,.@-]+)*|automatic}
        REGION_REGEX = /^(us|eu|ap|sa|ca)\-\w+\-\d+$|^cn\-\w+\-\d+$|^us\-gov\-\w+\-\d+$/
        REGION_VALIDATOR = proc { filled? & str? & format?(REGION_REGEX) }
        ROLE_REGEX = %r{arn:aws:iam::[0-9]+:role\/([\w+=,.@-]+)*}
        ROLE_SESSION_NAME_REGEX = /[\w+=,.@-]*/
        SECRET_ACCESS_KEY_REGEX = //
        SECRET_ACCESS_KEY_VALIDATOR = proc { filled? & str? & format?(SECRET_ACCESS_KEY_REGEX) }

        AwsAssumeRole::Types::Region = Dry::Strict::String.constrained(
            format: REGION_REGEX,
        )

        AwsAssumeRole::Types::MfaSerial = Dry::Strict::String.constrained(
            format: MFA_REGEX,
        )
    end
end

Version data entries

19 entries across 19 versions & 1 rubygems

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