<commit_before>require 'fog/aws/core'

module Fog
  module AWS
    class RDS < Fog::Service
      extend Fog::AWS::CredentialFetcher::ServiceMethods

      class IdentifierTaken < Fog::Errors::Error; end

      class AuthorizationAlreadyExists < Fog::Errors::Error; end

      requires :aws_access_key_id, :aws_secret_access_key
      recognizes :region, :host, :path, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at, :version, :instrumentor, :instrumentor_name

      request_path 'fog/aws/requests/rds'
      request :describe_events
      request :create_db_instance
      request :modify_db_instance
      request :describe_db_instances
      request :delete_db_instance
      request :reboot_db_instance
      request :create_db_instance_read_replica
      request :describe_db_engine_versions
      request :describe_db_reserved_instances

      request :add_tags_to_resource
      request :list_tags_for_resource
      request :remove_tags_from_resource

      request :describe_db_snapshots
      request :create_db_snapshot
      request :delete_db_snapshot

      request :create_db_parameter_group
      request :delete_db_parameter_group
      request :modify_db_parameter_group
      request :describe_db_parameter_groups

      request :describe_db_security_groups
      request :create_db_security_group
      request :delete_db_security_group
      request :authorize_db_security_group_ingress
      request :revoke_db_security_group_ingress

      request :describe_db_parameters

      request :restore_db_instance_from_db_snapshot
      request :restore_db_instance_to_point_in_time

      request :create_db_subnet_group
      request :describe_db_subnet_groups
      request :delete_db_subnet_group
      # TODO: :modify_db_subnet_group

      request :describe_orderable_db_instance_options

      request :describe_db_log_files
      request :download_db_logfile_portion

      request :promote_read_replica

      request :describe_event_subscriptions
      request :create_event_subscription
      request :delete_event_subscription

      model_path 'fog/aws/models/rds'
      model       :server
      collection  :servers

      model       :snapshot
      collection  :snapshots

      model       :parameter_group
      collection  :parameter_groups

      model       :parameter
      collection  :parameters

      model       :security_group
      collection  :security_groups

      model       :subnet_group
      collection  :subnet_groups

      model       :instance_option
      collection  :instance_options

      model       :log_file
      collection  :log_files

      model       :event_subscription
      collection  :event_subscriptions

      class Mock
        def self.data
          @data ||= Hash.new do |hash, region|
            hash[region] = Hash.new do |region_hash, key|
              region_hash[key] = {
                :servers             => {},
                :security_groups     => {},
                :subnet_groups       => {},
                :snapshots           => {},
                :event_subscriptions => {},
                :parameter_groups    => {
                  "default.mysql5.1" => {
                    "DBParameterGroupFamily" => "mysql5.1",
                    "Description"            => "Default parameter group for mysql5.1",
                    "DBParameterGroupName"   => "default.mysql5.1"
                  },
                  "default.mysql5.5" => {
                    "DBParameterGroupFamily" => "mysql5.5",
                    "Description"            => "Default parameter group for mysql5.5",
                    "DBParameterGroupName"   => "default.mysql5.5"
                  }
                }
              }
            end
          end
        end

        def self.reset
          @data = nil
        end

        attr_accessor :region

        def initialize(options={})
          @use_iam_profile = options[:use_iam_profile]
          @region = options[:region] || 'us-east-1'

          unless ['ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', 'eu-central-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1'].include?(@region)
            raise ArgumentError, "Unknown region: #{@region.inspect}"
          end
        end

        def data
          self.class.data[@region][@aws_access_key_id]
        end

        def reset_data
          self.class.data[@region].delete(@aws_access_key_id)
        end<commit_msg>call setup_credentials in rds mock<commit_after>require 'fog/aws/core'

module Fog
  module AWS
    class RDS < Fog::Service
      extend Fog::AWS::CredentialFetcher::ServiceMethods

      class IdentifierTaken < Fog::Errors::Error; end

      class AuthorizationAlreadyExists < Fog::Errors::Error; end

      requires :aws_access_key_id, :aws_secret_access_key
      recognizes :region, :host, :path, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at, :version, :instrumentor, :instrumentor_name

      request_path 'fog/aws/requests/rds'
      request :describe_events
      request :create_db_instance
      request :modify_db_instance
      request :describe_db_instances
      request :delete_db_instance
      request :reboot_db_instance
      request :create_db_instance_read_replica
      request :describe_db_engine_versions
      request :describe_db_reserved_instances

      request :add_tags_to_resource
      request :list_tags_for_resource
      request :remove_tags_from_resource

      request :describe_db_snapshots
      request :create_db_snapshot
      request :delete_db_snapshot

      request :create_db_parameter_group
      request :delete_db_parameter_group
      request :modify_db_parameter_group
      request :describe_db_parameter_groups

      request :describe_db_security_groups
      request :create_db_security_group
      request :delete_db_security_group
      request :authorize_db_security_group_ingress
      request :revoke_db_security_group_ingress

      request :describe_db_parameters

      request :restore_db_instance_from_db_snapshot
      request :restore_db_instance_to_point_in_time

      request :create_db_subnet_group
      request :describe_db_subnet_groups
      request :delete_db_subnet_group
      # TODO: :modify_db_subnet_group

      request :describe_orderable_db_instance_options

      request :describe_db_log_files
      request :download_db_logfile_portion

      request :promote_read_replica

      request :describe_event_subscriptions
      request :create_event_subscription
      request :delete_event_subscription

      model_path 'fog/aws/models/rds'
      model       :server
      collection  :servers

      model       :snapshot
      collection  :snapshots

      model       :parameter_group
      collection  :parameter_groups

      model       :parameter
      collection  :parameters

      model       :security_group
      collection  :security_groups

      model       :subnet_group
      collection  :subnet_groups

      model       :instance_option
      collection  :instance_options

      model       :log_file
      collection  :log_files

      model       :event_subscription
      collection  :event_subscriptions

      class Mock
        def self.data
          @data ||= Hash.new do |hash, region|
            hash[region] = Hash.new do |region_hash, key|
              region_hash[key] = {
                :servers             => {},
                :security_groups     => {},
                :subnet_groups       => {},
                :snapshots           => {},
                :event_subscriptions => {},
                :parameter_groups    => {
                  "default.mysql5.1" => {
                    "DBParameterGroupFamily" => "mysql5.1",
                    "Description"            => "Default parameter group for mysql5.1",
                    "DBParameterGroupName"   => "default.mysql5.1"
                  },
                  "default.mysql5.5" => {
                    "DBParameterGroupFamily" => "mysql5.5",
                    "Description"            => "Default parameter group for mysql5.5",
                    "DBParameterGroupName"   => "default.mysql5.5"
                  }
                }
              }
            end
          end
        end

        def self.reset
          @data = nil
        end

        attr_accessor :region

        def initialize(options={})
          @use_iam_profile = options[:use_iam_profile]
          @region          = options[:region] || 'us-east-1'

          unless ['ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2', 'eu-central-1', 'eu-west-1', 'us-east-1', 'us-west-1', 'us-west-2', 'sa-east-1'].include?(@region)
            raise ArgumentError, "Unknown region: #{@region.inspect}"
          end

          setup_credentials(options)
        end

        def data
          self.class.data[@region][@aws_access_key_id]
        end

        def reset_data
          self.class.data[@region].delete(@aws_access_key_id)
        end
{'fraction_non_alphanumeric': 0.07636283381152063, 'fraction_numerical': 0.0057382476274553075, 'mean_word_length': 2.17109867039888, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2179505', 'n_tokens_mistral': 2610, 'n_tokens_neox': 2498, 'n_words': 476}