Sha256: 4e29cb03e0ffb53547a0d87aaa440e8cf04b727f4daeb63e0c0ff40d8b0ba3ee

Contents?: true

Size: 1.93 KB

Versions: 18

Compression:

Stored size: 1.93 KB

Contents

module Fog
  module Sql
    class AzureRM
      # Real class for Sql Server Request
      class Real
        def create_or_update_sql_server(server_hash)
          msg = "Creating SQL Server: #{server_hash[:name]}."
          Fog::Logger.debug msg
          begin
            sql_server = @sql_mgmt_client.servers.create_or_update(server_hash[:resource_group],
                                                                   server_hash[:name],
                                                                   format_server_parameters(server_hash[:location],
                                                                                            server_hash[:version],
                                                                                            server_hash[:administrator_login],
                                                                                            server_hash[:administrator_login_password]))
          rescue MsRestAzure::AzureOperationError => e
            raise_azure_exception(e, msg)
          end
          Fog::Logger.debug "SQL Server: #{server_hash[:name]} created successfully."
          sql_server
        end

        private

        def format_server_parameters(location, version, admin_login, admin_password)
          server = Azure::ARM::SQL::Models::Server.new
          server.version = version
          server.location = location
          server.administrator_login = admin_login
          server.administrator_login_password = admin_password
          server
        end
      end

      # Mock class for Sql Server Request
      class Mock
        def create_or_update_sql_server(*)
          {
            'location' => '{server-location}',
            'properties' => {
              'version' => '{server-version}',
              'administratorLogin' => '{admin-name}',
              'administratorLoginPassword' => '{admin-password}'
            }
          }
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
fog-azure-rm-temp-0.0.4 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-temp-0.0.3 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-0.3.3 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-temp-0.0.2 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-temp-0.0.1 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-0.3.2 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-downgraded-0.3.1 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-0.3.1 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-downgraded-0.3.0 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-0.3.0 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-0.2.7 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-0.2.6 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-0.2.5 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-0.2.4 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-0.2.3 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-0.2.2 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-0.2.1 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb
fog-azure-rm-0.2.0 lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb