Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cms backend #776

Merged
merged 7 commits into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Common.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<SmoPackageVersion>150.18040.0-preview</SmoPackageVersion>
<SmoPackageVersion>150.18085.0-preview</SmoPackageVersion>
<HighEntropyVA>true</HighEntropyVA>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration >
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="Nuget Preview" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="Nuget" value="https://www.nuget.org/api/v2" />
<add key="DataTools Nuget" value="./bin/nuget" />
<add key="DataTools Nuget" value="./bin/nuget" />
</packageSources>
</configuration>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../Common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand All @@ -8,7 +9,7 @@
<Folder Include="Localization\transXliff\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SqlServer.SqlManagementObjects" Version="150.18040.0-preview" />
<PackageReference Include="Microsoft.SqlServer.SqlManagementObjects" Version="$(SmoPackageVersion)" />
<PackageReference Include="System.Data.SqlClient" Version="4.6.0" />
</ItemGroup>
<ItemGroup>
Expand Down
434 changes: 434 additions & 0 deletions src/Microsoft.SqlTools.ServiceLayer/Cms/CmsService.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
//
// 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.ServiceLayer.Connection.Contracts;

namespace Microsoft.SqlTools.ServiceLayer.Cms.Contracts
{
/// <summary>
/// Paramaters to create Top level Central Management Server
/// </summary>
public class CreateCentralManagementServerParams
{
public string RegisteredServerName { get; set; }

public string RegisterdServerDescription { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small typo: RegisteredServerDescription


public ConnectParams ConnectParams { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this class derive from ConnectParams instead?

}

/// <summary>
/// Parmaters to Add Registered Server to top level CMS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Parmaters -> Parameters

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..note this same typo appears to have been copy\pasted a few times

/// </summary>
public class AddRegisteredServerParams
{
public string RegisteredServerName { get; set; }

public string RegisterdServerDescription { get; set; }

public ConnectionDetails RegServerConnectionDetails { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should be consistent whether to use RegisteredServer or RegServer, personally I would always use RegisteredServer event though it's too verbose.


public string ParentOwnerUri { get; set; }

public string RelativePath { get; set; }
}

/// <summary>
/// Parmaters to Add Server Group to top level CMS
/// </summary>
public class AddServerGroupParams
{
public string GroupName { get; set; }

public string GroupDescription { get; set; }

public string ParentOwnerUri { get; set; }

public string RelativePath { get; set; }
}

/// <summary>
/// Parmaters to Remove Server Group from CMS
/// </summary>
public class RemoveServerGroupParams
{
public string GroupName { get; set; }

public string ParentOwnerUri { get; set; }

public string RelativePath { get; set; }
}

/// <summary>
/// Paramaters to remove a Registered Server from CMS tree
/// </summary>
public class RemoveRegisteredServerParams
{
public string RegisteredServerName { get; set; }

public string ParentOwnerUri { get; set; }

public string RelativePath { get; set; }
}

/// <summary>
/// Paramaters to list a Registered Server from CMS tree
/// </summary>
public class ListRegisteredServerParams
{
public string ParentOwnerUri { get; set; }

public string RelativePath { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// 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;
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;

namespace Microsoft.SqlTools.ServiceLayer.Cms.Contracts
{

public class CreateCentralManagementServerRequest
{
public static readonly RequestType<CreateCentralManagementServerParams, ListRegisteredServersResult> Type =
RequestType<CreateCentralManagementServerParams, ListRegisteredServersResult>.Create("cms/createCms");
}

public class ListRegisteredServerRequest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be ListRegisteredServersRequest (plural)?

{
public static readonly RequestType<ListRegisteredServerParams, ListRegisteredServersResult> Type =
RequestType<ListRegisteredServerParams, ListRegisteredServersResult>.Create("cms/listRegServers");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd write out RegisteredServers completely in the JSON-RPC method names.

}

public class AddRegisteredServerRequest
{
public static readonly RequestType<AddRegisteredServerParams, bool> Type =
RequestType<AddRegisteredServerParams, bool>.Create("cms/addRegServers");
}

public class AddServerGroupRequest
{
public static readonly RequestType<AddServerGroupParams, bool> Type =
RequestType<AddServerGroupParams, bool>.Create("cms/addCmsServerGroup");
}

public class RemoveServerGroupRequest
{
public static readonly RequestType<RemoveServerGroupParams, bool> Type =
RequestType<RemoveServerGroupParams, bool>.Create("cms/removeCmsServerGroup");
}

public class RemoveRegisteredServerRequest
{
public static readonly RequestType<RemoveRegisteredServerParams, bool> Type =
RequestType<RemoveRegisteredServerParams, bool>.Create("cms/removeRegServers");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// 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.ServiceLayer.Connection.Contracts;
using System.Collections.Generic;

namespace Microsoft.SqlTools.ServiceLayer.Cms.Contracts
{
public class ListRegisteredServersResult
{
public List<RegisteredServerResult> RegisteredServersList { get; set; }

public List<RegisteredServerGroup> RegisteredServerGroups { get; set; }
}

public class RegisteredServerResult
{
public string Name { get; set; }

public string ServerName { get; set; }

public string Description { get; set; }

public string RelativePath { get; set; }

public ConnectionDetails connectionDetails { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connectionDetails should be ConnectionDetails

}

public class RegisteredServerGroup
{
public string Name { get; set; }

public string Description { get; set; }

public string RelativePath { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ public static SqlConnectionStringBuilder CreateConnectionStringBuilder(Connectio
{
await requestContext.SendResult(ParseConnectionString(connectionString));
}
catch (Exception e)
catch (Exception)
{
// If theres an error in the parse, it means we just can't parse, so we return undefined
// rather than an error.
Expand Down
4 changes: 4 additions & 0 deletions src/Microsoft.SqlTools.ServiceLayer/HostLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Microsoft.SqlTools.Hosting.Protocol;
using Microsoft.SqlTools.ServiceLayer.Admin;
using Microsoft.SqlTools.ServiceLayer.Agent;
using Microsoft.SqlTools.ServiceLayer.Cms;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.DacFx;
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery;
Expand Down Expand Up @@ -114,6 +115,9 @@ private static void InitializeRequestHandlersAndServices(ServiceHost serviceHost
DacFxService.Instance.InitializeService(serviceHost);
serviceProvider.RegisterSingleService(DacFxService.Instance);

CmsService.Instance.InitializeService(serviceHost);
serviceProvider.RegisterSingleService(CmsService.Instance);

InitializeHostedServices(serviceProvider, serviceHost);
serviceHost.ServiceProvider = serviceProvider;

Expand Down
Loading