Add linting for copyright and unused usings (#1416)

* Add linting for copyright and unused usings

* Add one more + comment

* Enforce in build and fix errors

* Fix build
This commit is contained in:
Charles Gagnon
2022-03-04 15:17:29 -08:00
committed by GitHub
parent 025f9af4fd
commit c248400a6c
233 changed files with 1323 additions and 364 deletions

View File

@@ -1,9 +1,11 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net.Sockets;
using System.Globalization;
namespace Microsoft.InsightsGenerator
{

View File

@@ -1,4 +1,9 @@
using System;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Concurrent;
using System.Composition;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.Connection.Contracts
{
public class RequestSecurityTokenParams

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.Connection.Contracts
{
public class RequestSecurityTokenResponse

View File

@@ -1,3 +1,8 @@
//
// 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.Kusto.ServiceLayer.Connection.Contracts

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.Connection
{
public interface IConnectionManager

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Threading.Tasks;
using Microsoft.Kusto.ServiceLayer.Connection.Contracts;
using Microsoft.Kusto.ServiceLayer.LanguageServices;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Contracts
{
public class DataSourceConnectionDetails

View File

@@ -1,6 +1,8 @@
// <copyright file="KustoQueryUtils.cs" company="Microsoft">
// Copyright (c) Microsoft. All Rights Reserved.
// </copyright>
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Data;

View File

@@ -1,6 +1,7 @@
// <copyright file="DataSourceUtils.cs" company="Microsoft">
// Copyright (c) Microsoft. All Rights Reserved.
// </copyright>
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;

View File

@@ -1,4 +1,9 @@
using System;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Composition;
using Kusto.Data;

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource
{
/// <summary>
/// Represents the type of a data source.

View File

@@ -1,4 +1,9 @@
using System.Collections.Generic;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Generic;
namespace Microsoft.Kusto.ServiceLayer.DataSource
{

View File

@@ -1,4 +1,9 @@
using System;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.Kusto.ServiceLayer.Connection.Contracts;
namespace Microsoft.Kusto.ServiceLayer.DataSource

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Linq;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Intellisense
{
public class ShowDatabaseSchemaResult

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Intellisense
{
public class ShowDatabasesResult

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Intellisense
{
public class ShowFunctionsResult

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Generic;
using System.Data;
using System.Threading;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Data;

View File

@@ -1,6 +1,7 @@
// <copyright file="KustoDataSource.cs" company="Microsoft">
// Copyright (c) Microsoft. All Rights Reserved.
// </copyright>
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Concurrent;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Linq;

View File

@@ -1,4 +1,9 @@
using System.Collections.Generic;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Generic;
using System.Data;
namespace Microsoft.Kusto.ServiceLayer.DataSource.Kusto

View File

@@ -1,6 +1,8 @@
// <copyright file="KustoQueryUtils.cs" company="Microsoft">
// Copyright (c) Microsoft. All Rights Reserved.
// </copyright>
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
{
/// <summary>
/// Column metadata information

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
{
/// <summary>
/// Metadata type enumeration

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
{
/// <summary>
/// Object metadata information

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
{
/// <summary>
/// Database metadata information

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
{
/// <summary>
/// Folder metadata information

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
{
public class FunctionMetadata : DatabaseMetadata
{

View File

@@ -1,4 +1,9 @@
using System;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Kusto.ServiceLayer.Admin.Contracts;

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Metadata
{
/// <summary>
/// Database metadata information

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Models
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Models
{
public class ColumnInfo
{

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Models
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Models
{
public class FunctionInfo
{

View File

@@ -1,4 +1,9 @@
namespace Microsoft.Kusto.ServiceLayer.DataSource.Models
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Models
{
public class TableInfo
{

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Net.Http;
using System.Net.Http.Headers;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Data;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Data;
using System.Linq;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Generic;
using System.Linq;
using Kusto.Language;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Monitor.Responses.Models
{
public class ColumnsModel

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Monitor.Responses.Models
{
public class TableGroupsModel

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Monitor.Responses.Models
{
public class TablesModel

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.DataSource.Monitor.Responses.Models
{
public class WorkspacesModel

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.Kusto.ServiceLayer.DataSource.Monitor.Responses.Models;
namespace Microsoft.Kusto.ServiceLayer.DataSource.Monitor.Responses

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Threading.Tasks;

View File

@@ -1,4 +1,9 @@
using System;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Threading;
using Microsoft.Kusto.ServiceLayer.Connection;

View File

@@ -1,3 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.Kusto.ServiceLayer.Connection;
using Microsoft.Kusto.ServiceLayer.Connection.Contracts;
using Microsoft.Kusto.ServiceLayer.DataSource;

View File

@@ -1,4 +1,9 @@
using System;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

View File

@@ -1,6 +1,8 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using Microsoft.SqlTools.ServiceLayer.SqlContext;
using Microsoft.Kusto.ServiceLayer.Utility;

View File

@@ -1,6 +1,7 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;

View File

@@ -1,6 +1,7 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;

View File

@@ -1,6 +1,7 @@
//
//
// 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;

View File

@@ -1,6 +1,7 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.QueryExecution.Contracts.ExecuteRequests
{

View File

@@ -1,6 +1,7 @@
//
//
// 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;

View File

@@ -1,6 +1,7 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.QueryExecution.Contracts
{

View File

@@ -1,6 +1,7 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.Kusto.ServiceLayer.Workspace.Contracts;

View File

@@ -1,6 +1,7 @@
//
//
// 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;
using System.Threading.Tasks;

View File

@@ -1,5 +1,4 @@
//
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//

View File

@@ -1,6 +1,8 @@
//
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
namespace Microsoft.Kusto.ServiceLayer.QueryExecution

View File

@@ -1,4 +1,9 @@
using Microsoft.Kusto.ServiceLayer.DataSource;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.Kusto.ServiceLayer.DataSource;
using Microsoft.Kusto.ServiceLayer.Scripting.Contracts;
using Microsoft.SqlServer.Management.Sdk.Sfc;

View File

@@ -1,4 +1,9 @@
using Microsoft.SqlServer.Dac;
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlServer.Dac;
using System;
namespace Microsoft.Kusto.ServiceLayer.Utility

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Globalization;
using Microsoft.SqlTools.Hosting.Utility;

View File

@@ -1,6 +1,7 @@
// <copyright file="SystemExtensions.cs" company="Microsoft">
// Copyright (c) Microsoft. All Rights Reserved.
// </copyright>
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.Utility
{

View File

@@ -1,6 +1,7 @@
// <copyright file="ValidationUtils.cs" company="Microsoft">
// Copyright (c) Microsoft. All Rights Reserved.
// </copyright>
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.Kusto.ServiceLayer.Utility
{

View File

@@ -0,0 +1,15 @@
# See https://github.com/dotnet/roslyn-analyzers/blob/main/.editorconfig for an example on different settings and how they're used
# Disable checking for correct header for this project - most of the code is borrowed from other projects
# which have different style guidelines
[*.cs]
dotnet_diagnostic.IDE0073.severity = none
[*]
indent_style = space
indent_size = 4
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Threading;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;

View File

@@ -1,6 +1,7 @@
//
//
// 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.ServiceLayer.BatchParser.ExecutionEngineCode
{

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Threading.Tasks;
@@ -9,11 +10,11 @@ using Microsoft.SqlTools.ResourceProvider.Core.Extensibility;
namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
/// <summary>
/// An account manager has the information of currently logged in user and can authenticate the user
/// An account manager has the information of currently logged in user and can authenticate the user
/// Implementing classes must add a <see cref="ExportableAttribute" />
/// to the class in order to be found by the extension manager,
/// and to define the type and category supported
/// </summary>
/// </summary>
public interface IAccountManager : IExportable
{
/// <summary>
@@ -46,7 +47,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
/// </summary>
bool HasLoginDialog
{
get;
get;
}
/// <summary>

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Generic;
using System.Threading.Tasks;
@@ -8,7 +9,7 @@ using System.Threading.Tasks;
namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
/// <summary>
/// Provides functionality to authenticate to Azure and discover associated accounts and subscriptions
/// Provides functionality to authenticate to Azure and discover associated accounts and subscriptions
/// </summary>
public interface IAzureAuthenticationManager : IAccountManager
{
@@ -38,6 +39,6 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
/// <summary>
/// Stores the selected subscriptions given the ids
/// </summary>
Task<bool> SetSelectedSubscriptionsAsync(IEnumerable<string> subscriptionIds);
Task<bool> SetSelectedSubscriptionsAsync(IEnumerable<string> subscriptionIds);
}
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
@@ -30,6 +31,6 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
string SubscriptionId
{
get;
}
}
}
}

View File

@@ -1,6 +1,7 @@
//
// 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.ResourceProvider.Core.Authentication
{
@@ -16,7 +17,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
get;
}
/// <summary>
/// Display ID
/// </summary>
@@ -24,6 +25,6 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
get;
}
}
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
@@ -18,6 +19,6 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
IAzureUserAccount UserAccount
{
get;
}
}
}
}

View File

@@ -1,6 +1,7 @@
//
// 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.ResourceProvider.Core.Authentication
{
@@ -16,7 +17,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
get;
}
/// <summary>
/// Returns true if user needs reauthentication
/// </summary>
@@ -24,6 +25,6 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Authentication
{
get;
}
}
}

View File

@@ -30,12 +30,12 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
public AuthenticationService()
{
}
public override void InitializeService(IProtocolEndpoint serviceHost)
{
Logger.Write(TraceEventType.Verbose, "AuthenticationService initialized");
}
public async Task<IUserAccount> SetCurrentAccountAsync(Account account, Dictionary<string, AccountSecurityToken> securityTokenMappings)
{
var authManager = ServiceProvider.GetService<IAzureAuthenticationManager>();

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
@@ -13,7 +14,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// </summary>
public static class CommonUtil
{
private const int KeyValueNameLength = 1024; // 1024 should be enough for registry key value name.
private const int KeyValueNameLength = 1024; // 1024 should be enough for registry key value name.
//********************************************************************************************
/// <summary>
@@ -44,7 +45,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
//********************************************************************************************
/// <summary>
/// Throw an exception if a string is null or empty.
/// Throw an exception if a string is null or empty.
/// </summary>
/// <param name="stringVar">string to check</param>
/// <param name="stringVarName">the variable or parameter name to display</param>
@@ -97,6 +98,6 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
return message;
}
}
}

View File

@@ -1,6 +1,7 @@
//
// 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.ResourceProvider.Core
{

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Data.Common;
@@ -18,7 +19,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// Returns true if given exception if any of the inner exceptions is UserNeedsAuthenticationException
/// </summary>
internal static bool IsUserNeedsReauthenticateException(this Exception ex)
{
{
return ex.IsExceptionType(typeof(UserNeedsAuthenticationException));
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Runtime.Serialization;
@@ -8,7 +9,7 @@ using System.Runtime.Serialization;
namespace Microsoft.SqlTools.ResourceProvider.Core
{
/// <summary>
/// The exception is used if any operation fails as a request failed due to an expired token
/// The exception is used if any operation fails as a request failed due to an expired token
/// </summary>
public class ExpiredTokenException : ServiceExceptionBase
{
@@ -29,11 +30,11 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
}
/// <summary>
/// Initializes a new instance of the ServiceFailedException class with a specified error message
/// Initializes a new instance of the ServiceFailedException class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// (Nothing in Visual Basic) if no inner exception is specified</param>
public ExpiredTokenException(string message, Exception innerException)
: base(message, innerException)

View File

@@ -35,11 +35,11 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// </summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="httpStatusCode">The Http error code. </param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// (Nothing in Visual Basic) if no inner exception is specified</param>
public ServiceExceptionBase(string message, HttpStatusCode httpStatusCode, Exception innerException = null)
: this(message, (int)httpStatusCode, innerException)
{
{
}
/// <summary>
@@ -47,7 +47,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// </summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="httpStatusCode">The Http error code. </param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// (Nothing in Visual Basic) if no inner exception is specified</param>
public ServiceExceptionBase(string message, int httpStatusCode, Exception innerException)
: base(message, innerException)
@@ -57,11 +57,11 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
}
/// <summary>
/// Initializes a new instance of the AuthenticationFailedException class with a specified error message
/// Initializes a new instance of the AuthenticationFailedException class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// (Nothing in Visual Basic) if no inner exception is specified</param>
protected ServiceExceptionBase(string message, Exception innerException)
: base(message, innerException)

View File

@@ -32,11 +32,11 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
}
/// <summary>
/// Initializes a new instance of the ServiceFailedException class with a specified error message
/// Initializes a new instance of the ServiceFailedException class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// (Nothing in Visual Basic) if no inner exception is specified</param>
public ServiceFailedException(string message, Exception innerException)
: base(message, innerException)
@@ -54,13 +54,13 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
}
/// <summary>
/// Creates a new instance of ServiceFailedException by adding the server definition info to the given message
/// Creates a new instance of ServiceFailedException by adding the server definition info to the given message
/// </summary>
internal static ServiceFailedException CreateException(string message, ServerDefinition serverDefinition, Exception innerException)
{
return new ServiceFailedException(
string.Format(CultureInfo.CurrentCulture, message,
serverDefinition != null ? serverDefinition.ServerType : string.Empty,
string.Format(CultureInfo.CurrentCulture, message,
serverDefinition != null ? serverDefinition.ServerType : string.Empty,
serverDefinition != null ? serverDefinition.Category : string.Empty), innerException);
}
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Runtime.Serialization;
@@ -8,7 +9,7 @@ using System.Runtime.Serialization;
namespace Microsoft.SqlTools.ResourceProvider.Core
{
/// <summary>
/// The exception is used if any operation fails becauase user needs to reauthenticate
/// The exception is used if any operation fails becauase user needs to reauthenticate
/// </summary>
public class UserNeedsAuthenticationException : ServiceExceptionBase
{
@@ -29,11 +30,11 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
}
/// <summary>
/// Initializes a new instance of the ServiceFailedException class with a specified error message
/// Initializes a new instance of the ServiceFailedException class with a specified error message
/// and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference
/// (Nothing in Visual Basic) if no inner exception is specified</param>
public UserNeedsAuthenticationException(string message, Exception innerException)
: base(message, innerException)

View File

@@ -68,13 +68,13 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Contracts
public class ProviderSettings
{
/// <summary>
/// Display name of the provider
/// Display name of the provider
/// </summary>
public string DisplayName;
/// <summary>
/// ID of the provider
/// </summary>
/// </summary>
public string Id;
/// <summary>
/// Settings for the provider itself

View File

@@ -28,7 +28,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Contracts
/// </summary>
public Account Account { get; set; }
/// <summary>
/// Per-tenant token mappings. Ideally would be set independently of this call, but for
/// Per-tenant token mappings. Ideally would be set independently of this call, but for
/// now this allows us to get the tokens necessary to find a server and open a firewall rule
/// </summary>
public Dictionary<string,AccountSecurityToken> SecurityTokenMappings { get; set; }
@@ -47,7 +47,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Contracts
/// End of the IP address range
/// </summary>
public string EndIpAddress { get; set; }
}
public class CreateFirewallRuleResponse : TokenReliantResponse
@@ -61,7 +61,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core.Contracts
public class CanHandleFirewallRuleRequest
{
public static readonly
RequestType<HandleFirewallRuleParams, HandleFirewallRuleResponse> Type =
RequestType<HandleFirewallRuleParams, HandleFirewallRuleResponse> Type =
RequestType<HandleFirewallRuleParams, HandleFirewallRuleResponse>.Create("resource/handleFirewallRule");
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
@@ -16,8 +17,8 @@ using Microsoft.SqlTools.Utility;
namespace Microsoft.SqlTools.ResourceProvider.Core
{
/// <summary>
/// Default implementation for <see cref="IDatabaseDiscoveryProvider"/> for Azure Sql databases.
/// A discovery provider capable of finding Sql Azure databases for a specific Azure user account.
/// Default implementation for <see cref="IDatabaseDiscoveryProvider"/> for Azure Sql databases.
/// A discovery provider capable of finding Sql Azure databases for a specific Azure user account.
/// </summary>
[Exportable(
@@ -35,7 +36,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
public AzureDatabaseDiscoveryProvider()
{
// Duplicate the exportable attribute as at present we do not support filtering using extensiondescriptor.
// The attribute is preserved in order to simplify ability to backport into existing tools
// The attribute is preserved in order to simplify ability to backport into existing tools
Metadata = new ExportableMetadata(
ServerTypes.SqlServer,
Categories.Azure,
@@ -90,9 +91,9 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
}
/// <summary>
/// Returns the databases for given connection info.
/// Returns the databases for given connection info.
/// The connection info should be used to make the connection for getting databases not the account manager
/// </summary>
/// </summary>
//public async Task<ServiceResponse<DatabaseInstanceInfo>> GetDatabaseInstancesAsync(UIConnectionInfo uiConnectionInfo, CancellationToken cancellationToken)
//{
// ServiceResponse<DatabaseInstanceInfo> result = null;
@@ -109,7 +110,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// <summary>
/// Returns the databases for given server name. Using the account manager to get the databases
/// </summary>
/// </summary>
public async Task<ServiceResponse<DatabaseInstanceInfo>> GetDatabaseInstancesAsync(string serverName, CancellationToken cancellationToken)
{
ServiceResponse<DatabaseInstanceInfo> result = null;
@@ -120,7 +121,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
//if connection is passed, we need to search all subscriptions not selected ones
IEnumerable<IAzureUserAccountSubscriptionContext> subscriptions = await GetSubscriptionsAsync(string.IsNullOrEmpty(serverName));
if (!cancellationToken.IsCancellationRequested)
{
{
result = await AzureUtil.ExecuteGetAzureResourceAsParallel((object)null, subscriptions, serverName, cancellationToken,
GetDatabaseForSubscriptionAsync);
}
@@ -159,7 +160,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
get
{
return (_azureAccountManager = _azureAccountManager ?? GetService<IAzureAuthenticationManager>());
}
}
}
/// <summary>
@@ -206,11 +207,11 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// <summary>
/// There was a wired nullReferencedException was running the tasks parallel. It only got fixed when I put the getting from cache insed an async method
/// </summary>
/// </summary>
private Task<ServiceResponse<DatabaseInstanceInfo>> GetFromCacheAsync(string key)
{
return Task.Factory.StartNew(() => _cache.Get(key));
}
}
/// <summary>
/// Returns a list of Azure sql databases for given subscription
@@ -235,7 +236,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
else if (shouldFilter)
{
//we should filter the result because the cached data includes databases for all servers
result = new ServiceResponse<DatabaseInstanceInfo>(result.Data.Where(x => x.ServerInstanceInfo.FullyQualifiedDomainName == serverName),
result = new ServiceResponse<DatabaseInstanceInfo>(result.Data.Where(x => x.ServerInstanceInfo.FullyQualifiedDomainName == serverName),
result.Errors);
}
@@ -243,7 +244,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
if (!shouldFilter && !cancellationToken.IsCancellationRequested)
{
result = _cache.UpdateCache(key, result);
}
}
}
catch (Exception ex)
{
@@ -261,7 +262,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
CancellationToken cancellationToken, CancellationToken internalCancellationToken)
{
ServiceResponse<DatabaseInstanceInfo> result = null;
try
{
if (!cancellationToken.IsCancellationRequested && !internalCancellationToken.IsCancellationRequested)
@@ -295,7 +296,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
return result ?? new ServiceResponse<DatabaseInstanceInfo>();
}
private async Task<ServiceResponse<DatabaseInstanceInfo>> GetDatabasesForSubscriptionServersAsync(IAzureResourceManagementSession session,
private async Task<ServiceResponse<DatabaseInstanceInfo>> GetDatabasesForSubscriptionServersAsync(IAzureResourceManagementSession session,
IList<IAzureSqlServerResource> filteredServersList, CancellationToken cancellationToken)
{
ServiceResponse<DatabaseInstanceInfo> result = null;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
@@ -43,7 +44,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
result = await AzureUtil.ExecuteGetAzureResourceAsParallel(_session, serverResources, null, cancellationToken, GetDatabasesForServerFromService);
}
return result;
}
}
private async Task<ServiceResponse<DatabaseInstanceInfo>> GetDatabasesForServerFromService(
IAzureResourceManagementSession session,
@@ -108,7 +109,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// <summary>
/// Converts the resource to DatabaseInstanceInfo
/// </summary>
/// </summary>
private DatabaseInstanceInfo ConvertToModel(ServerInstanceInfo serverInstanceInfo, IAzureResource azureResource)
{
DatabaseInstanceInfo databaseInstance = new DatabaseInstanceInfo(serverInstanceInfo)

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
@@ -12,11 +13,11 @@ using Microsoft.SqlTools.ResourceProvider.Core.Extensibility;
namespace Microsoft.SqlTools.ResourceProvider.Core
{
/// <summary>
/// Default implementation for <see cref="IServerDiscoveryProvider"/> for Azure Sql servers.
/// A discovery provider capable of finding Sql Azure servers for a specific Azure user account.
/// Default implementation for <see cref="IServerDiscoveryProvider"/> for Azure Sql servers.
/// A discovery provider capable of finding Sql Azure servers for a specific Azure user account.
/// </summary>
[Exportable(
ServerTypes.SqlServer,
ServerTypes.SqlServer,
Categories.Azure,
typeof(IServerDiscoveryProvider),
"Microsoft.SqlServer.ConnectionServices.Azure.AzureServerDiscoveryProvider")]
@@ -28,7 +29,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
public AzureSqlServerDiscoveryProvider()
{
// Duplicate the exportable attribute as at present we do not support filtering using extensiondescriptor.
// The attribute is preserved in order to simplify ability to backport into existing tools
// The attribute is preserved in order to simplify ability to backport into existing tools
Metadata = new ExportableMetadata(
ServerTypes.SqlServer,
Categories.Azure,
@@ -120,6 +121,6 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
{
_azureAccountManager = value as IAzureAuthenticationManager;
}
}
}
}
}

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
@@ -12,7 +13,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
public class DatabaseInstanceInfo
{
/// <summary>
/// Default constructor to initialize the instance
/// Default constructor to initialize the instance
/// </summary>
/// <param name="serverInstanceInfo"></param>
public DatabaseInstanceInfo(ServerInstanceInfo serverInstanceInfo)
@@ -34,7 +35,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// </summary>
public ServerInstanceInfo ServerInstanceInfo
{
get;
get;
private set;
}

View File

@@ -1,6 +1,7 @@
//
// 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.ResourceProvider.Core
{

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using Microsoft.SqlTools.ResourceProvider.Core.Authentication;
@@ -11,7 +12,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// A session used by <see cref="IAzureResourceManager" />. Includes all the clients that the resource management needs to get ther resources
/// </summary>
public interface IAzureResourceManagementSession : IDisposable
{
{
/// <summary>
/// Closes the session
/// </summary>

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Collections.Generic;
using System.Threading.Tasks;
@@ -24,7 +25,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// <returns>The list of databases</returns>
Task<IEnumerable<IAzureResource>> GetAzureDatabasesAsync(
IAzureResourceManagementSession azureResourceManagementSession,
string resourceGroupName,
string resourceGroupName,
string serverName);
/// <summary>
@@ -43,8 +44,8 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// <param name="firewallRuleRequest">Firewall rule request including the name and IP address range</param>
/// <returns></returns>
Task<FirewallRuleResponse> CreateFirewallRuleAsync(
IAzureResourceManagementSession azureResourceManagementSession,
IAzureSqlServerResource azureSqlServer,
IAzureResourceManagementSession azureResourceManagementSession,
IAzureSqlServerResource azureSqlServer,
FirewallRuleRequest firewallRuleRequest
);
@@ -52,7 +53,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
/// <summary>
/// Gets all subscription contexts under a specific user account. Queries all tenants for the account and uses these to log in
/// Gets all subscription contexts under a specific user account. Queries all tenants for the account and uses these to log in
/// and retrieve subscription information as needed
/// <param name="userAccount">Account whose subscriptions should be queried</param>
/// </summary>

View File

@@ -1,6 +1,7 @@
//
// 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.ResourceProvider.Core
{
@@ -11,7 +12,7 @@ namespace Microsoft.SqlTools.ResourceProvider.Core
{
/// <summary>
/// Fully qualified domain name
/// </summary>
/// </summary>
string FullyQualifiedDomainName
{
get;

View File

@@ -1,6 +1,7 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Threading;
using System.Threading.Tasks;
@@ -8,10 +9,10 @@ using System.Threading.Tasks;
namespace Microsoft.SqlTools.ResourceProvider.Core
{
/// <summary>
/// Defines a class as cachable
/// </summary>
/// Defines a class as cachable
/// </summary>
public interface ICacheable<T>
{
{
/// <summary>
/// Clears the cache for current user
/// </summary>

Some files were not shown because too many files have changed in this diff Show More