Provide connection options to host process (#267)

* Stage changes to other machine

* Add connection options in init message

* Fix option type
This commit is contained in:
Karl Burtram
2017-03-07 11:00:52 -08:00
committed by GitHub
parent 4de152847e
commit 17d2d825eb
5 changed files with 278 additions and 6 deletions

View File

@@ -0,0 +1,29 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
namespace Microsoft.SqlTools.Hosting.Contracts
{
/// <summary>
/// Defines a message that is sent from the client to request
/// the version of the server.
/// </summary>
public class CapabilitiesRequest
{
public static readonly
RequestType<CapabilitiesRequest, CapabilitiesResult> Type =
RequestType<CapabilitiesRequest, CapabilitiesResult>.Create("capabilities/list");
public string HostName { get; set; }
public string HostVersion { get; set; }
}
public class CapabilitiesResult
{
public DmpServerCapabilities Capabilities { get; set; }
}
}

View File

@@ -0,0 +1,67 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.Hosting.Contracts
{
/// <summary>
/// Defines the connection provider options that the DMP server
/// implements. This includes metadata regarding supported connection
/// properties.
/// </summary>
public class ConnectionProviderOptions
{
public ConnectionOption[] Options { get; set; }
}
public class ConnectionOption
{
public static readonly string ValueTypeString = "string";
public static readonly string ValueTypeMultiString = "multistring";
public static readonly string ValueTypePassword = "password";
public static readonly string ValueTypeNumber = "number";
public static readonly string ValueTypeCategory = "category";
public static readonly string ValueTypeBoolean = "boolean";
public static readonly string SpecialValueServerName = "serverName";
public static readonly string SpecialValueDatabaseName = "databaseName";
public static readonly string SpecialValueAuthType = "authType";
public static readonly string SpecialValueUserName = "userName";
public static readonly string SpecialValuePasswordName = "password";
public string Name { get; set; }
public string DisplayName { get; set; }
/// <summary>
/// Type of the parameter. Can be either string, number, or category.
/// </summary>
public string ValueType { get; set; }
public string DefaultValue { get; set; }
/// <summary>
/// Set of permitted values if ValueType is category.
/// </summary>
public string[] CategoryValues { get; set; }
/// <summary>
/// Determines if the parameter is one of the 'specical' known values.
/// Can be either Server Name, Database Name, Authentication Type,
/// User Name, or Password
/// </summary>
public string SpecialValueType { get; set; }
/// <summary>
/// Flag to indicate that this option is part of the connection identity
/// </summary>
public bool IsIdentity { get; set; }
/// <summary>
/// Flag to indicate that this option is required
/// </summary>
public bool IsRequired { get; set; }
}
}

View File

@@ -5,11 +5,17 @@
namespace Microsoft.SqlTools.Hosting.Contracts
{
/// <summary>
/// Defines the DMP server capabilities
/// </summary>
public class DmpServerCapabilities
{
public string ProviderName { get; set;
}
public bool? HoverProvider { get; set; }
public string ProtocolVersion { get; set; }
public string ProviderName { get; set; }
public string ProviderDisplayName { get; set; }
public ConnectionProviderOptions ConnectionProvider { get; set; }
}
}