Sha256: 4a6aa807cb4f03e6effa56fd5b53b9e9da2d3e601b10923cae73c4d38d88caee

Contents?: true

Size: 1.55 KB

Versions: 14

Compression:

Stored size: 1.55 KB

Contents

module Fog
  module Google
    class SQL
      ##
      # Sets the password for the root user
      #
      # @see https://developers.google.com/cloud-sql/docs/admin-api/v1beta3/instances/setRootPassword

      class Real
        def set_instance_root_password(instance_id, password)
          api_method = @sql.instances.set_root_password
          parameters = {
            "project" => @project,
            "instance" => instance_id
          }

          body = {
            "setRootPasswordContext" => {
              "kind" => 'sql#setRootUserContext',
              "password" => password
            }
          }

          request(api_method, parameters, body)
        end
      end

      class Mock
        def set_instance_root_password(instance_id, _password)
          operation = random_operation
          data[:operations][instance_id] ||= {}
          data[:operations][instance_id][operation] = {
            "kind" => 'sql#instanceOperation',
            "instance" => instance_id,
            "operation" => operation,
            "operationType" => "INJECT_USER",
            "state" => Fog::Google::SQL::Operation::DONE_STATE,
            "userEmailAddress" => "google_client_email@developer.gserviceaccount.com",
            "enqueuedTime" => Time.now.iso8601,
            "startTime" => Time.now.iso8601,
            "endTime" => Time.now.iso8601
          }

          body = {
            "kind" => 'sql#instancesSetRootPassword',
            "operation" => operation
          }

          build_excon_response(body)
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fog-google-0.6.0 lib/fog/google/requests/sql/set_instance_root_password.rb
fog-google-0.5.5 lib/fog/google/requests/sql/set_instance_root_password.rb
fog-google-0.5.4 lib/fog/google/requests/sql/set_instance_root_password.rb
fog-google-0.5.3 lib/fog/google/requests/sql/set_instance_root_password.rb
fog-google-0.5.2 lib/fog/google/requests/sql/set_instance_root_password.rb
fog-google-0.5.1 lib/fog/google/requests/sql/set_instance_root_password.rb
fog-google-0.5.0 lib/fog/google/requests/sql/set_instance_root_password.rb
fog-google-0.4.2 lib/fog/google/requests/sql/set_instance_root_password.rb
fog-google-0.4.1 lib/fog/google/requests/sql/set_instance_root_password.rb
fog-google-0.4.0 lib/fog/google/requests/sql/set_instance_root_password.rb
fog-google-0.3.2 lib/fog/google/requests/sql/set_instance_root_password.rb
fog-google-0.3.1 lib/fog/google/requests/sql/set_instance_root_password.rb
fog-google-0.3.0 lib/fog/google/requests/sql/set_instance_root_password.rb
fog-google-0.2.0 lib/fog/google/requests/sql/set_instance_root_password.rb