Skip to content

Commit c8ab647

Browse files
fix conflicts
2 parents c6b9dd7 + 8468bcd commit c8ab647

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

src/DataShare/DataShare/Synchronization/StartAzDataShareSynchronization.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@ public class StartAzDataShareSynchronization : AzureDataShareCmdletBase
9898
[ValidateNotNullOrEmpty]
9999
public string ResourceId { get; set; }
100100

101+
/// <summary>
102+
/// Data share subscription object
103+
/// </summary>
104+
[Parameter(
105+
Mandatory = true,
106+
ParameterSetName = ParameterSetNames.ObjectParameterSet,
107+
ValueFromPipeline = true,
108+
HelpMessage = "Azure data share subscription object")]
109+
[ValidateNotNullOrEmpty]
110+
public PSDataShareSubscription InputObject { get; set; }
111+
101112
[Parameter]
102113
public SwitchParameter AsJob { get; set; }
103114

@@ -127,11 +138,25 @@ private void StartSynchronization()
127138

128139
private void SetParametersIfNeeded()
129140
{
141+
string resourceId = null;
142+
130143
if (this.ParameterSetName.Equals(
131144
ParameterSetNames.ResourceIdParameterSet,
132145
StringComparison.OrdinalIgnoreCase))
133146
{
134-
var parsedResourceId = new ResourceIdentifier(this.ResourceId);
147+
resourceId = this.ResourceId;
148+
}
149+
150+
if (this.ParameterSetName.Equals(
151+
ParameterSetNames.ObjectParameterSet,
152+
StringComparison.OrdinalIgnoreCase))
153+
{
154+
resourceId = this.InputObject.Id;
155+
}
156+
157+
if (!string.IsNullOrEmpty(resourceId))
158+
{
159+
var parsedResourceId = new ResourceIdentifier(resourceId);
135160
this.ResourceGroupName = parsedResourceId.ResourceGroupName;
136161
this.AccountName = parsedResourceId.GetAccountName();
137162
this.ShareSubscriptionName = parsedResourceId.GetShareSubscriptionName();

src/DataShare/DataShare/Synchronization/StopAzDataShareSubscriptionSynchronization.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ public class StopAzDataShareSubscriptionSynchronization : AzureDataShareCmdletBa
9797
[ValidateNotNullOrEmpty]
9898
public string ResourceId { get; set; }
9999

100+
/// <summary>
101+
/// Data share subscription object
102+
/// </summary>
103+
[Parameter(
104+
Mandatory = true,
105+
ParameterSetName = ParameterSetNames.ObjectParameterSet,
106+
ValueFromPipeline = true,
107+
HelpMessage = "Azure data share subscription object")]
108+
[ValidateNotNullOrEmpty]
109+
public PSDataShareSubscription InputObject { get; set; }
110+
100111
[Parameter]
101112
public SwitchParameter AsJob { get; set; }
102113

@@ -133,11 +144,25 @@ private void StopSynchronization()
133144

134145
private void SetParametersIfNeeded()
135146
{
147+
string resourceId = null;
148+
136149
if (this.ParameterSetName.Equals(
137150
ParameterSetNames.ResourceIdParameterSet,
138151
StringComparison.OrdinalIgnoreCase))
139152
{
140-
var parsedResourceId = new ResourceIdentifier(this.ResourceId);
153+
resourceId = this.ResourceId;
154+
}
155+
156+
if (this.ParameterSetName.Equals(
157+
ParameterSetNames.ObjectParameterSet,
158+
StringComparison.OrdinalIgnoreCase))
159+
{
160+
resourceId = this.InputObject.Id;
161+
}
162+
163+
if (!string.IsNullOrEmpty(resourceId))
164+
{
165+
var parsedResourceId = new ResourceIdentifier(resourceId);
141166
this.ResourceGroupName = parsedResourceId.ResourceGroupName;
142167
this.AccountName = parsedResourceId.GetAccountName();
143168
this.ShareSubscriptionName = parsedResourceId.GetShareSubscriptionName();

0 commit comments

Comments
 (0)