Skip to content

Commit 5b28e54

Browse files
ankushbindlish2VeryEarlystefong99
authored
Az.StorageSync MI GA Release (Shared/storage sync to main) (#27376)
Co-authored-by: Yabo Hu <[email protected]> Co-authored-by: stefong99 <[email protected]>
1 parent cec4de9 commit 5b28e54

File tree

103 files changed

+36404
-21688
lines changed

Some content is hidden

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

103 files changed

+36404
-21688
lines changed

src/StorageSync/StorageSync.Management.Sdk/Generated/IRegisteredServersOperations.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ public partial interface IRegisteredServersOperations
115115
/// <param name='serverId'>
116116
/// GUID identifying the on-premises server.
117117
/// </param>
118-
/// <param name='identity'>
119-
/// Apply server with newly discovered ApplicationId if available.
118+
/// <param name='parameters'>
119+
/// Body of Registered Server object.
120120
/// </param>
121121
/// <param name='customHeaders'>
122122
/// The headers that will be added to request.
@@ -130,7 +130,7 @@ public partial interface IRegisteredServersOperations
130130
/// <exception cref="Microsoft.Rest.SerializationException">
131131
/// Thrown when unable to deserialize the response
132132
/// </exception>
133-
System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> UpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?), System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
133+
System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> UpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters, System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
134134

135135
/// <summary>
136136
/// Delete the given registered server.
@@ -234,8 +234,8 @@ public partial interface IRegisteredServersOperations
234234
/// <param name='serverId'>
235235
/// GUID identifying the on-premises server.
236236
/// </param>
237-
/// <param name='identity'>
238-
/// Apply server with newly discovered ApplicationId if available.
237+
/// <param name='parameters'>
238+
/// Body of Registered Server object.
239239
/// </param>
240240
/// <param name='customHeaders'>
241241
/// The headers that will be added to request.
@@ -249,7 +249,7 @@ public partial interface IRegisteredServersOperations
249249
/// <exception cref="Microsoft.Rest.SerializationException">
250250
/// Thrown when unable to deserialize the response
251251
/// </exception>
252-
System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?), System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
252+
System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters, System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
253253

254254
/// <summary>
255255
/// Delete the given registered server.

src/StorageSync/StorageSync.Management.Sdk/Generated/Models/RegisteredServerUpdateParameters.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@ public RegisteredServerUpdateParameters()
4242

4343
/// <param name="identity">Apply server with newly discovered ApplicationId if available.
4444
/// </param>
45-
public RegisteredServerUpdateParameters(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), bool? identity = default(bool?))
45+
46+
/// <param name="applicationId">Apply server with new ServicePrincipal Id
47+
/// </param>
48+
public RegisteredServerUpdateParameters(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), bool? identity = default(bool?), string applicationId = default(string))
4649

4750
: base(id, name, type, systemData)
4851
{
4952
this.Identity = identity;
53+
this.ApplicationId = applicationId;
5054
CustomInit();
5155
}
5256

@@ -61,5 +65,11 @@ public RegisteredServerUpdateParameters()
6165
/// </summary>
6266
[Newtonsoft.Json.JsonProperty(PropertyName = "properties.identity")]
6367
public bool? Identity {get; set; }
68+
69+
/// <summary>
70+
/// Gets or sets apply server with new ServicePrincipal Id
71+
/// </summary>
72+
[Newtonsoft.Json.JsonProperty(PropertyName = "properties.applicationId")]
73+
public string ApplicationId {get; set; }
6474
}
6575
}

src/StorageSync/StorageSync.Management.Sdk/Generated/Models/RegisteredServerUpdateProperties.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ public RegisteredServerUpdateProperties()
2626

2727
/// <param name="identity">Apply server with newly discovered ApplicationId if available.
2828
/// </param>
29-
public RegisteredServerUpdateProperties(bool? identity = default(bool?))
29+
30+
/// <param name="applicationId">Apply server with new ServicePrincipal Id
31+
/// </param>
32+
public RegisteredServerUpdateProperties(bool? identity = default(bool?), string applicationId = default(string))
3033

3134
{
3235
this.Identity = identity;
36+
this.ApplicationId = applicationId;
3337
CustomInit();
3438
}
3539

@@ -44,5 +48,11 @@ public RegisteredServerUpdateProperties()
4448
/// </summary>
4549
[Newtonsoft.Json.JsonProperty(PropertyName = "identity")]
4650
public bool? Identity {get; set; }
51+
52+
/// <summary>
53+
/// Gets or sets apply server with new ServicePrincipal Id
54+
/// </summary>
55+
[Newtonsoft.Json.JsonProperty(PropertyName = "applicationId")]
56+
public string ApplicationId {get; set; }
4757
}
4858
}

src/StorageSync/StorageSync.Management.Sdk/Generated/RegisteredServersOperations.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -542,19 +542,19 @@ internal RegisteredServersOperations (StorageSyncManagementClient client)
542542
/// <param name='serverId'>
543543
/// GUID identifying the on-premises server.
544544
/// </param>
545-
/// <param name='identity'>
546-
/// Apply server with newly discovered ApplicationId if available.
545+
/// <param name='parameters'>
546+
/// Body of Registered Server object.
547547
/// </param>
548548
/// <param name='customHeaders'>
549549
/// Headers that will be added to request.
550550
/// </param>
551551
/// <param name='cancellationToken'>
552552
/// The cancellation token.
553553
/// </param>
554-
public async System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> UpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?), System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
554+
public async System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> UpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters, System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
555555
{
556556
// Send Request
557-
Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders> _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, serverId, identity, customHeaders, cancellationToken).ConfigureAwait(false);
557+
Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders> _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, serverId, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
558558
return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
559559
}
560560

@@ -875,8 +875,8 @@ internal RegisteredServersOperations (StorageSyncManagementClient client)
875875
/// <param name='serverId'>
876876
/// GUID identifying the on-premises server.
877877
/// </param>
878-
/// <param name='identity'>
879-
/// Apply server with newly discovered ApplicationId if available.
878+
/// <param name='parameters'>
879+
/// Body of Registered Server object.
880880
/// </param>
881881
/// <param name='customHeaders'>
882882
/// Headers that will be added to request.
@@ -899,12 +899,16 @@ internal RegisteredServersOperations (StorageSyncManagementClient client)
899899
/// <return>
900900
/// A response object containing the response body and response headers.
901901
/// </return>
902-
public async System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?), System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
902+
public async System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<RegisteredServer,RegisteredServersUpdateHeaders>> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters, System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
903903
{
904904

905905

906906

907907

908+
if (parameters == null)
909+
{
910+
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters");
911+
}
908912

909913
if (resourceGroupName == null)
910914
{
@@ -936,11 +940,6 @@ internal RegisteredServersOperations (StorageSyncManagementClient client)
936940
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "serverId");
937941
}
938942

939-
RegisteredServerUpdateParameters parameters = new RegisteredServerUpdateParameters();
940-
if(identity != null)
941-
{
942-
parameters.Identity = identity;
943-
}
944943
// Tracing
945944
bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
946945
string _invocationId = null;

src/StorageSync/StorageSync.Management.Sdk/Generated/RegisteredServersOperationsExtensions.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ public static RegisteredServer Create(this IRegisteredServersOperations operatio
156156
/// <param name='serverId'>
157157
/// GUID identifying the on-premises server.
158158
/// </param>
159-
public static RegisteredServer Update(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?))
159+
public static RegisteredServer Update(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters)
160160
{
161-
return ((IRegisteredServersOperations)operations).UpdateAsync(resourceGroupName, storageSyncServiceName, serverId, identity).GetAwaiter().GetResult();
161+
return ((IRegisteredServersOperations)operations).UpdateAsync(resourceGroupName, storageSyncServiceName, serverId, parameters).GetAwaiter().GetResult();
162162
}
163163

164164
/// <summary>
@@ -179,9 +179,9 @@ public static RegisteredServer Create(this IRegisteredServersOperations operatio
179179
/// <param name='cancellationToken'>
180180
/// The cancellation token.
181181
/// </param>
182-
public static async System.Threading.Tasks.Task<RegisteredServer> UpdateAsync(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
182+
public static async System.Threading.Tasks.Task<RegisteredServer> UpdateAsync(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
183183
{
184-
using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, serverId, identity, null, cancellationToken).ConfigureAwait(false))
184+
using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, serverId, parameters, null, cancellationToken).ConfigureAwait(false))
185185
{
186186
return _result.Body;
187187
}
@@ -336,9 +336,9 @@ public static RegisteredServer BeginCreate(this IRegisteredServersOperations ope
336336
/// <param name='serverId'>
337337
/// GUID identifying the on-premises server.
338338
/// </param>
339-
public static RegisteredServer BeginUpdate(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?))
339+
public static RegisteredServer BeginUpdate(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters)
340340
{
341-
return ((IRegisteredServersOperations)operations).BeginUpdateAsync(resourceGroupName, storageSyncServiceName, serverId, identity).GetAwaiter().GetResult();
341+
return ((IRegisteredServersOperations)operations).BeginUpdateAsync(resourceGroupName, storageSyncServiceName, serverId, parameters).GetAwaiter().GetResult();
342342
}
343343

344344
/// <summary>
@@ -359,9 +359,9 @@ public static RegisteredServer BeginCreate(this IRegisteredServersOperations ope
359359
/// <param name='cancellationToken'>
360360
/// The cancellation token.
361361
/// </param>
362-
public static async System.Threading.Tasks.Task<RegisteredServer> BeginUpdateAsync(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, bool? identity = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
362+
public static async System.Threading.Tasks.Task<RegisteredServer> BeginUpdateAsync(this IRegisteredServersOperations operations, string resourceGroupName, string storageSyncServiceName, string serverId, RegisteredServerUpdateParameters parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
363363
{
364-
using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, serverId, identity, null, cancellationToken).ConfigureAwait(false))
364+
using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, serverId, parameters, null, cancellationToken).ConfigureAwait(false))
365365
{
366366
return _result.Body;
367367
}

src/StorageSync/StorageSync.Management.Sdk/Generated/StorageSyncManagementClient.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ public StorageSyncManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceCli
305305
/// <param name='rootHandler'>
306306
/// Optional. The http client handler used to handle http transport.
307307
/// </param>
308+
/// <param name='handlers'>
309+
/// Optional. The delegating handlers to add to the http client pipeline.
310+
/// </param>
308311
/// <exception cref="System.ArgumentNullException">
309312
/// Thrown when a required parameter is null
310313
/// </exception>

src/StorageSync/StorageSync.Management.Sdk/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ In this directory, run AutoRest:
66
```
77
autorest --reset
88
autorest --use:@autorest/[email protected]
9-
autorest.cmd README.md --version=v2
109
```
1110

1211
### AutoRest Configuration
@@ -27,7 +26,7 @@ payload-flattening-threshold: 1
2726
2827
###
2928
``` yaml
30-
commit: 9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0
29+
commit: c29b9330313c91d43a75d9d08144c98071c904d0
3130
input-file:
3231
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2022-09-01/storagesync.json
3332

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Define the directory and file pattern
2+
$directory = "."
3+
$filePattern = "*Test*.json"
4+
5+
# Define a regex pattern to match the specific pattern for Storage Account keys ending with ==
6+
$pattern = '\\\"value\\\":\s\\\"(?<SAKey>[a-zA-Z0-9+/=]{86}==)\\\",'
7+
# Iterate over all files in the directory matching the pattern
8+
Get-ChildItem -Path $directory -Filter $filePattern -Recurse | ForEach-Object {
9+
# Initialize a hash set to store unique matched keys
10+
$storageAccountKeys = [System.Collections.Generic.HashSet[string]]::new()
11+
12+
$fileContent = Get-Content -Path $_.FullName -Raw
13+
Write-Output $_.FullName
14+
# Find all matches in the file content
15+
$matches = [regex]::Matches($fileContent, $pattern)
16+
17+
$shouldContinue = $false
18+
# Extract and store the keys
19+
foreach ($match in $matches) {
20+
$storageAccountKeys.Add($match.Groups["SAKey"].Value) | Out-Null
21+
$shouldContinue = $true
22+
}
23+
# Print each unique matched key
24+
foreach ($key in $storageAccountKeys) {
25+
Write-Output $key
26+
}
27+
if($shouldContinue)
28+
{
29+
# Replace all matches in the file content with *REDACTED*
30+
$modifiedContent = [regex]::Replace($fileContent, $pattern, '\"value\": \"*REDACTED*\",')
31+
32+
# Save the modified content back to the file
33+
Set-Content -Path $_.FullName -Value $modifiedContent -Force
34+
}
35+
}
36+
37+
# Print a message indicating completion
38+
Write-Output "All keys have been replaced with *REDACTED* in the specified files."
39+

src/StorageSync/StorageSync.Test/Common/MockEcsManagementInteropClient.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,5 +693,10 @@ public IConnectionPoint GetStableVersionDeepGcConnectionPoint()
693693
{
694694
throw new NotImplementedException();
695695
}
696+
697+
public int ResetServerCertificateSettingsRegistry()
698+
{
699+
throw new NotImplementedException();
700+
}
696701
}
697702
}

src/StorageSync/StorageSync.Test/Common/MockServerManagedIdentityProvider.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ namespace Microsoft.Azure.Commands.StorageSync.Test.Common
1111
{
1212
internal class MockServerManagedIdentityProvider : IServerManagedIdentityProvider
1313
{
14+
/// <summary>
15+
/// Gets the name of the test.
16+
/// </summary>
17+
/// <value>The name of the test.</value>
18+
protected string TestName;
19+
20+
public MockServerManagedIdentityProvider(string testName)
21+
{
22+
this.TestName = testName;
23+
}
24+
1425
public bool EnableMIChecking { get; set; }
1526

1627
public Guid GetServerApplicationId(LocalServerType serverType, bool throwIfNotFound = true, bool validateSystemAssignedManagedIdentity = true)
@@ -20,6 +31,10 @@ public Guid GetServerApplicationId(LocalServerType serverType, bool throwIfNotFo
2031

2132
public LocalServerType GetServerType(IEcsManagement ecsManagement)
2233
{
34+
if(TestName == "TestPatchRegisteredServer")
35+
{
36+
return LocalServerType.ArcEnabledHybridServer;
37+
}
2338
return LocalServerType.HybridServer;
2439
}
2540
}

0 commit comments

Comments
 (0)