Skip to content

Commit 227d92a

Browse files
houjiaqi21houjiaqiwyunchi-ms
authored
Add support for Synapse link connection (#17845)
* linktable cmd * LinkConnection LinkTable cmd * gdd support for Synapse Link Connection * update * Changed tableStatus display format * Update Artifacts * resolved conflicts * fix build error Co-authored-by: houjiaqi <[email protected]> Co-authored-by: Yunchi Wang <[email protected]>
1 parent ad5596f commit 227d92a

File tree

48 files changed

+3587
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3587
-4
lines changed

src/Synapse/Synapse/Az.Synapse.psd1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,16 @@ CmdletsToExport = 'Get-AzSynapseSparkJob', 'Stop-AzSynapseSparkJob',
228228
'Export-AzSynapseKqlScript',
229229
'Get-AzSynapseActiveDirectoryOnlyAuthentication',
230230
'Enable-AzSynapseActiveDirectoryOnlyAuthentication',
231-
'Disable-AzSynapseActiveDirectoryOnlyAuthentication'
231+
'Disable-AzSynapseActiveDirectoryOnlyAuthentication',
232+
'Set-AzSynapseLinkConnectionLinkTable','Get-AzSynapseLinkConnectionLinkTable',
233+
'Get-AzSynapseLinkConnectionLinkTableStatus',
234+
'Update-AzSynapseLinkConnectionLandingZoneCredential',
235+
'Get-AzSynapseLinkConnection',
236+
'Set-AzSynapseLinkConnection',
237+
'Start-AzSynapseLinkConnection',
238+
'Stop-AzSynapseLinkConnection',
239+
'Remove-AzSynapseLinkConnection',
240+
'Get-AzSynapseLinkConnectionDetailedStatus'
232241

233242
# Variables to export from this module
234243
# VariablesToExport = @()
@@ -251,7 +260,8 @@ AliasesToExport = 'New-AzSynapsePipeline', 'New-AzSynapseLinkedService',
251260
'Set-AzSynapseManagedPrivateEndpoint', 'New-AzSynapseSqlScript',
252261
'Import-AzSynapseSqlScript', 'Set-AzSynapseSparkConfiguration',
253262
'Import-AzSynapseSparkConfiguration', 'Set-AzSynapseKqlScript',
254-
'Import-AzSynapseKqlScript'
263+
'Import-AzSynapseKqlScript',
264+
'New-AzSynapseLinkConnection'
255265

256266
# DSC resources to export from this module
257267
# DscResourcesToExport = @()

src/Synapse/Synapse/ChangeLog.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
-->
2020

2121
## Upcoming Release
22+
* Added support for Synapse Link for Azure Sql Database
23+
- Added `Get-AzSynapseLinkConnection` cmdlet
24+
- Added `Get-AzSynapseLinkConnectionDetailedStatus` cmdlet
25+
- Added `Set-AzSynapseLinkConnection` cmdlet
26+
- Added `Remove-AzSynapseLinkConnection` cmdlet
27+
- Added `Start-AzSynapseLinkConnection` cmdlet
28+
- Added `Stop-AzSynapseLinkConnection` cmdlet
29+
- Added `Set-AzSynapseLinkConnectionLinkTable` cmdlet
30+
- Added `Get-AzSynapseLinkConnectionLinkTable` cmdlet
31+
- Added `Get-AzSynapseLinkConnectionLinkTableStatus` cmdlet
32+
- Added `Update-AzSynapseLinkConnectionLandingZoneCredential` cmdlet
2233
* Set UploadedTimestamp when adding package to spark pool by `Update-AzSynapseSparkPool`
2334

2435
## Version 1.3.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.Synapse.Common;
16+
using Microsoft.Azure.Commands.Synapse.Models;
17+
using System.Management.Automation;
18+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
19+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
20+
21+
namespace Microsoft.Azure.Commands.Synapse
22+
{
23+
[Cmdlet(VerbsCommon.Get, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + SynapseConstants.SynapsePrefix + SynapseConstants.LinkConnectionDetailedStatus, DefaultParameterSetName = GetByName)]
24+
[OutputType(typeof(PSLinkConnectionDetailedStatus))]
25+
public class GetAzureSynapseLinkConnectionDetailedStatus : SynapseArtifactsCmdletBase
26+
{
27+
private const string GetByName = "GetByName";
28+
private const string GetByObject = "GetByObject";
29+
30+
[Parameter(ValueFromPipelineByPropertyName = false, ParameterSetName = GetByName,
31+
Mandatory = true, HelpMessage = HelpMessages.WorkspaceName)]
32+
[ResourceNameCompleter(ResourceTypes.Workspace, "ResourceGroupName")]
33+
[ValidateNotNullOrEmpty]
34+
public override string WorkspaceName { get; set; }
35+
36+
[Parameter(ValueFromPipeline = true, ParameterSetName = GetByObject,
37+
Mandatory = true, HelpMessage = HelpMessages.WorkspaceObject)]
38+
[ValidateNotNull]
39+
public PSSynapseWorkspace WorkspaceObject { get; set; }
40+
41+
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = HelpMessages.LinkConnectionName)]
42+
[ValidateNotNullOrEmpty]
43+
[Alias("LinkConnectionName")]
44+
public string Name { get; set; }
45+
46+
public override void ExecuteCmdlet()
47+
{
48+
if (this.IsParameterBound(c => c.WorkspaceObject))
49+
{
50+
this.WorkspaceName = this.WorkspaceObject.Name;
51+
}
52+
WriteObject(new PSLinkConnectionDetailedStatus(SynapseAnalyticsClient.GetLinkConnectionDetailedStatus(this.Name), this.WorkspaceName));
53+
}
54+
}
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
16+
using Microsoft.Azure.Commands.Synapse.Common;
17+
using Microsoft.Azure.Commands.Synapse.Models;
18+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
19+
using System.Linq;
20+
using System.Management.Automation;
21+
22+
namespace Microsoft.Azure.Commands.Synapse
23+
{
24+
[Cmdlet(VerbsCommon.Get, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + SynapseConstants.SynapsePrefix + SynapseConstants.LinkConnectionLinkTable,
25+
DefaultParameterSetName = GetByName)]
26+
[OutputType(typeof(PSLinkTableResource))]
27+
public class GetAzureSynapseLinkConnectionLinkTable : SynapseArtifactsCmdletBase
28+
{
29+
private const string GetByName = "GetByName";
30+
private const string GetByObject = "GetByObject";
31+
private const string GetByInputObject = "GetByInputObject";
32+
33+
[Parameter(ValueFromPipelineByPropertyName = false, ParameterSetName = GetByName,
34+
Mandatory = true, HelpMessage = HelpMessages.WorkspaceName)]
35+
[ResourceNameCompleter(ResourceTypes.Workspace, "ResourceGroupName")]
36+
[ValidateNotNullOrEmpty]
37+
public override string WorkspaceName { get; set; }
38+
39+
[Parameter(ValueFromPipeline = true, ParameterSetName = GetByObject,
40+
Mandatory = true, HelpMessage = HelpMessages.WorkspaceObject)]
41+
[ValidateNotNull]
42+
public PSSynapseWorkspace WorkspaceObject { get; set; }
43+
44+
[Parameter(ValueFromPipeline = true, ParameterSetName = GetByInputObject,
45+
Mandatory = true, HelpMessage = HelpMessages.LinkConnectionObject)]
46+
[ValidateNotNull]
47+
public PSLinkConnectionResource InputObject { get; set; }
48+
49+
[Parameter(ValueFromPipelineByPropertyName = false, ParameterSetName = GetByName,
50+
Mandatory = true, HelpMessage = HelpMessages.LinkConnectionName)]
51+
[Parameter(ValueFromPipelineByPropertyName = false, ParameterSetName = GetByObject,
52+
Mandatory = true, HelpMessage = HelpMessages.LinkConnectionName)]
53+
[ValidateNotNullOrEmpty]
54+
public string LinkConnectionName { get; set; }
55+
56+
public override void ExecuteCmdlet()
57+
{
58+
if (this.IsParameterBound(c => c.WorkspaceObject))
59+
{
60+
this.WorkspaceName = this.WorkspaceObject.Name;
61+
}
62+
63+
if (this.IsParameterBound(c => c.InputObject))
64+
{
65+
this.WorkspaceName = this.InputObject.WorkspaceName;
66+
this.LinkConnectionName = this.InputObject.Name;
67+
}
68+
69+
var linkTables = SynapseAnalyticsClient.ListLinkTables(this.LinkConnectionName)
70+
.Select(element => new PSLinkTableResource(element, this.WorkspaceName, this.LinkConnectionName));
71+
WriteObject(linkTables, true);
72+
}
73+
}
74+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Azure.Analytics.Synapse.Artifacts.Models;
16+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
17+
using Microsoft.Azure.Commands.Synapse.Common;
18+
using Microsoft.Azure.Commands.Synapse.Models;
19+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
20+
using System.Linq;
21+
using System.Management.Automation;
22+
23+
namespace Microsoft.Azure.Commands.Synapse
24+
{
25+
[Cmdlet(VerbsCommon.Get, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + SynapseConstants.SynapsePrefix + SynapseConstants.LinkConnectionLinkTableStatus,
26+
DefaultParameterSetName = GetByName)]
27+
[OutputType(typeof(PSLinkConnectionQueryTableStatus))]
28+
public class GetAzureSynapseLinkConnectionLinkTableStatus : SynapseArtifactsCmdletBase
29+
{
30+
private const string GetByName = "GetByName";
31+
private const string GetByObject = "GetByObject";
32+
private const string GetByInputObject = "GetByInputObject";
33+
34+
[Parameter(ValueFromPipelineByPropertyName = false, ParameterSetName = GetByName,
35+
Mandatory = true, HelpMessage = HelpMessages.WorkspaceName)]
36+
[ResourceNameCompleter(ResourceTypes.Workspace, "ResourceGroupName")]
37+
[ValidateNotNullOrEmpty]
38+
public override string WorkspaceName { get; set; }
39+
40+
[Parameter(ValueFromPipeline = true, ParameterSetName = GetByObject,
41+
Mandatory = true, HelpMessage = HelpMessages.WorkspaceObject)]
42+
[ValidateNotNull]
43+
public PSSynapseWorkspace WorkspaceObject { get; set; }
44+
45+
[Parameter(ValueFromPipelineByPropertyName = false, ParameterSetName = GetByName,
46+
Mandatory = true, HelpMessage = HelpMessages.LinkConnectionName)]
47+
[Parameter(ValueFromPipelineByPropertyName = false, ParameterSetName = GetByObject,
48+
Mandatory = true, HelpMessage = HelpMessages.LinkConnectionName)]
49+
public string LinkConnectionName { get; set; }
50+
51+
[Parameter(ValueFromPipelineByPropertyName = false, Mandatory = true, HelpMessage = HelpMessages.MaxSegmentCount)]
52+
[ValidateNotNullOrEmpty]
53+
public int MaxSegmentCount { get; set; }
54+
55+
[Parameter(ValueFromPipeline = true, ParameterSetName = GetByInputObject,
56+
Mandatory = true, HelpMessage = HelpMessages.LinkConnectionObject)]
57+
[ValidateNotNull]
58+
public PSLinkConnectionResource InputObject { get; set; }
59+
60+
[Parameter(ValueFromPipelineByPropertyName = false, Mandatory = false, HelpMessage = HelpMessages.LinkTableContinuationToken)]
61+
[ValidateNotNullOrEmpty]
62+
public object ContinuationToken { get; set; }
63+
64+
public override void ExecuteCmdlet()
65+
{
66+
if (this.IsParameterBound(c => c.WorkspaceObject))
67+
{
68+
this.WorkspaceName = this.WorkspaceObject.Name;
69+
}
70+
71+
if (this.IsParameterBound(c => c.InputObject))
72+
{
73+
this.WorkspaceName = this.InputObject.WorkspaceName;
74+
this.LinkConnectionName = this.InputObject.Name;
75+
}
76+
77+
var queryTableStatusRequest = new QueryTableStatusRequest
78+
{
79+
MaxSegmentCount = this.MaxSegmentCount
80+
};
81+
82+
if (this.IsParameterBound(c => c.ContinuationToken))
83+
{
84+
queryTableStatusRequest.ContinuationToken = this.ContinuationToken;
85+
}
86+
87+
var linkTablesStatus = new PSLinkConnectionQueryTableStatus(SynapseAnalyticsClient.QueryTableStatus(this.LinkConnectionName, queryTableStatusRequest));
88+
89+
WriteObject(linkTablesStatus, true);
90+
}
91+
}
92+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
16+
using Microsoft.Azure.Commands.Synapse.Common;
17+
using Microsoft.Azure.Commands.Synapse.Models;
18+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
19+
using System.Linq;
20+
using System.Management.Automation;
21+
22+
namespace Microsoft.Azure.Commands.Synapse
23+
{
24+
[Cmdlet(VerbsCommon.Get,ResourceManager.Common.AzureRMConstants.AzureRMPrefix + SynapseConstants.SynapsePrefix + SynapseConstants.LinkConnection, DefaultParameterSetName = GetByName)]
25+
[OutputType(typeof(PSLinkConnectionResource))]
26+
public class GetAzureSynaspeLinkConnection: SynapseArtifactsCmdletBase
27+
{
28+
private const string GetByName = "GetByName";
29+
private const string GetByObject = "GetByObject";
30+
31+
[Parameter(ValueFromPipelineByPropertyName = false, ParameterSetName = GetByName,
32+
Mandatory = true, HelpMessage = HelpMessages.WorkspaceName)]
33+
[ResourceNameCompleter(ResourceTypes.Workspace, "ResourceGroupName")]
34+
[ValidateNotNullOrEmpty]
35+
public override string WorkspaceName { get; set; }
36+
37+
[Parameter(ValueFromPipeline = true, ParameterSetName = GetByObject,
38+
Mandatory = true, HelpMessage = HelpMessages.WorkspaceObject)]
39+
[ValidateNotNull]
40+
public PSSynapseWorkspace WorkspaceObject { get; set; }
41+
42+
[Parameter(ValueFromPipelineByPropertyName = false, Mandatory = false, HelpMessage = HelpMessages.LinkConnectionName)]
43+
[ValidateNotNullOrEmpty]
44+
[Alias("LinkConnectionName")]
45+
public string Name { get; set; }
46+
47+
public override void ExecuteCmdlet()
48+
{
49+
if (this.IsParameterBound(c => c.WorkspaceObject))
50+
{
51+
this.WorkspaceName = this.WorkspaceObject.Name;
52+
}
53+
54+
if(this.IsParameterBound(c => c.Name))
55+
{
56+
WriteObject(new PSLinkConnectionResource(SynapseAnalyticsClient.GetLinkConnection(this.Name), this.WorkspaceName));
57+
}
58+
else
59+
{
60+
var linkConnections = SynapseAnalyticsClient.GetLinkConnectionByWorkspace()
61+
.Select(element => new PSLinkConnectionResource(element,this.WorkspaceName));
62+
WriteObject(linkConnections, true);
63+
}
64+
}
65+
66+
}
67+
}

0 commit comments

Comments
 (0)