initialize

in utilities/aws-codedeploy-session-helper/lib/STSCredentialsProvider.rb [4:22]


    def initialize(args)
        raise ArgumentError.new("Param to STSCredentialsProvider.new() must be present, of type hash") if args.nil? or !args.is_a? Hash
        @role = args[:role]
        @creds_file = args[:creds_file]
        @region = args[:region]
        @session_name = args[:session_name]
        @duration = args[:duration]
        @output_arn = args[:output_arn]

        
        raise ArgumentError.new("No value for AWS IAM Role that the session credentials will assume, use --role-arn ROLE_ARN") if @role.nil?

        raise ArgumentError.new("No value for the fully qualified path that the session credentials will be written to, use --file FILEPATH") if @creds_file.nil?
        raise ArgumentError.new("Unable to write to directory " + File.dirname(@creds_file) + ".") unless File.writable?(File.dirname(@creds_file))
        raise ArgumentError.new("Unable to write to file " + @creds_file + ".") unless (File.exist?(@creds_file) ? File.writable?(@creds_file) : true)

        @session_name = Socket.gethostname if @session_name.nil?
    end