Skip to content

Commit 5ece84b

Browse files
authored
Update StorageSync project to support new MPG (#54532)
1 parent 2cd4cf9 commit 5ece84b

File tree

264 files changed

+21517
-14611
lines changed

Some content is hidden

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

264 files changed

+21517
-14611
lines changed

sdk/storagesync/Azure.ResourceManager.StorageSync/api/Azure.ResourceManager.StorageSync.net10.0.cs

Lines changed: 1735 additions & 0 deletions
Large diffs are not rendered by default.

sdk/storagesync/Azure.ResourceManager.StorageSync/api/Azure.ResourceManager.StorageSync.net8.0.cs

Lines changed: 181 additions & 6 deletions
Large diffs are not rendered by default.

sdk/storagesync/Azure.ResourceManager.StorageSync/api/Azure.ResourceManager.StorageSync.netstandard2.0.cs

Lines changed: 181 additions & 6 deletions
Large diffs are not rendered by default.

sdk/storagesync/Azure.ResourceManager.StorageSync/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "net",
44
"TagPrefix": "net/storagesync/Azure.ResourceManager.StorageSync",
5-
"Tag": "net/storagesync/Azure.ResourceManager.StorageSync_c39ab08b22"
5+
"Tag": "net/storagesync/Azure.ResourceManager.StorageSync_6b72d0af6d"
66
}

sdk/storagesync/Azure.ResourceManager.StorageSync/src/Azure.ResourceManager.StorageSync.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
<PackageId>Azure.ResourceManager.StorageSync</PackageId>
77
<Description>Microsoft Azure Resource Manager client SDK for Azure resource provider Microsoft.StorageSync.</Description>
88
<PackageTags>azure;management;arm;resource manager;storagesync</PackageTags>
9-
<IncludeAutorestDependency>true</IncludeAutorestDependency>
109
</PropertyGroup>
1110
</Project>

sdk/storagesync/Azure.ResourceManager.StorageSync/src/Custom/ArmStorageSyncModelFactory.cs

Lines changed: 175 additions & 0 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
#nullable disable
5+
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Threading.Tasks;
9+
using Azure.Core;
10+
using Azure.Core.Pipeline;
11+
using Azure.ResourceManager.StorageSync.Models;
12+
13+
namespace Azure.ResourceManager.StorageSync
14+
{
15+
// This class will be removed once we have support for new pageable decorator https://github.com/Azure/typespec-azure/issues/3650
16+
internal partial class StorageSyncServicesGetByStorageSyncServiceAsyncCollectionResultOfT : AsyncPageable<StorageSyncPrivateLinkResource>
17+
{
18+
private readonly StorageSyncServices _client;
19+
private readonly Guid _subscriptionId;
20+
private readonly string _resourceGroupName;
21+
private readonly string _storageSyncServiceName;
22+
private readonly RequestContext _context;
23+
24+
/// <summary> Initializes a new instance of StorageSyncServicesGetByStorageSyncServiceAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. </summary>
25+
/// <param name="client"> The StorageSyncServices client used to send requests. </param>
26+
/// <param name="subscriptionId"> The ID of the target subscription. The value must be an UUID. </param>
27+
/// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
28+
/// <param name="storageSyncServiceName"> Name of Storage Sync Service resource. </param>
29+
/// <param name="context"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
30+
public StorageSyncServicesGetByStorageSyncServiceAsyncCollectionResultOfT(StorageSyncServices client, Guid subscriptionId, string resourceGroupName, string storageSyncServiceName, RequestContext context) : base(context?.CancellationToken ?? default)
31+
{
32+
_client = client;
33+
_subscriptionId = subscriptionId;
34+
_resourceGroupName = resourceGroupName;
35+
_storageSyncServiceName = storageSyncServiceName;
36+
_context = context;
37+
}
38+
39+
/// <summary> Gets the pages of StorageSyncServicesGetByStorageSyncServiceAsyncCollectionResultOfT as an enumerable collection. </summary>
40+
/// <param name="continuationToken"> A continuation token indicating where to resume paging. </param>
41+
/// <param name="pageSizeHint"> The number of items per page. </param>
42+
/// <returns> The pages of StorageSyncServicesGetByStorageSyncServiceAsyncCollectionResultOfT as an enumerable collection. </returns>
43+
public override async IAsyncEnumerable<Page<StorageSyncPrivateLinkResource>> AsPages(string continuationToken, int? pageSizeHint)
44+
{
45+
Response response = await GetNextResponseAsync(pageSizeHint, null).ConfigureAwait(false);
46+
StorageSyncPrivateLinkResourceListResult result = StorageSyncPrivateLinkResourceListResult.FromResponse(response);
47+
yield return Page<StorageSyncPrivateLinkResource>.FromValues((IReadOnlyList<StorageSyncPrivateLinkResource>)result.Value, null, response);
48+
}
49+
50+
/// <summary> Get next page. </summary>
51+
/// <param name="pageSizeHint"> The number of items per page. </param>
52+
/// <param name="continuationToken"> A continuation token indicating where to resume paging. </param>
53+
private async ValueTask<Response> GetNextResponseAsync(int? pageSizeHint, string continuationToken)
54+
{
55+
HttpMessage message = _client.CreateGetByStorageSyncServiceRequest(_subscriptionId, _resourceGroupName, _storageSyncServiceName, _context);
56+
using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("StorageSyncServiceResource.GetByStorageSyncService");
57+
scope.Start();
58+
try
59+
{
60+
return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false);
61+
}
62+
catch (Exception e)
63+
{
64+
scope.Failed(e);
65+
throw;
66+
}
67+
}
68+
}
69+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
#nullable disable
5+
6+
using System;
7+
using System.Collections.Generic;
8+
using Azure.Core;
9+
using Azure.Core.Pipeline;
10+
using Azure.ResourceManager.StorageSync.Models;
11+
12+
namespace Azure.ResourceManager.StorageSync
13+
{
14+
// This class will be removed once we have support for new pageable decorator https://github.com/Azure/typespec-azure/issues/3650
15+
internal partial class StorageSyncServicesGetByStorageSyncServiceCollectionResultOfT : Pageable<StorageSyncPrivateLinkResource>
16+
{
17+
private readonly StorageSyncServices _client;
18+
private readonly Guid _subscriptionId;
19+
private readonly string _resourceGroupName;
20+
private readonly string _storageSyncServiceName;
21+
private readonly RequestContext _context;
22+
23+
/// <summary> Initializes a new instance of StorageSyncServicesGetByStorageSyncServiceCollectionResultOfT, which is used to iterate over the pages of a collection. </summary>
24+
/// <param name="client"> The StorageSyncServices client used to send requests. </param>
25+
/// <param name="subscriptionId"> The ID of the target subscription. The value must be an UUID. </param>
26+
/// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
27+
/// <param name="storageSyncServiceName"> Name of Storage Sync Service resource. </param>
28+
/// <param name="context"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
29+
public StorageSyncServicesGetByStorageSyncServiceCollectionResultOfT(StorageSyncServices client, Guid subscriptionId, string resourceGroupName, string storageSyncServiceName, RequestContext context) : base(context?.CancellationToken ?? default)
30+
{
31+
_client = client;
32+
_subscriptionId = subscriptionId;
33+
_resourceGroupName = resourceGroupName;
34+
_storageSyncServiceName = storageSyncServiceName;
35+
_context = context;
36+
}
37+
38+
/// <summary> Gets the pages of StorageSyncServicesGetByStorageSyncServiceCollectionResultOfT as an enumerable collection. </summary>
39+
/// <param name="continuationToken"> A continuation token indicating where to resume paging. </param>
40+
/// <param name="pageSizeHint"> The number of items per page. </param>
41+
/// <returns> The pages of StorageSyncServicesGetByStorageSyncServiceCollectionResultOfT as an enumerable collection. </returns>
42+
public override IEnumerable<Page<StorageSyncPrivateLinkResource>> AsPages(string continuationToken, int? pageSizeHint)
43+
{
44+
Response response = GetNextResponse(pageSizeHint, null);
45+
StorageSyncPrivateLinkResourceListResult result = StorageSyncPrivateLinkResourceListResult.FromResponse(response);
46+
yield return Page<StorageSyncPrivateLinkResource>.FromValues((IReadOnlyList<StorageSyncPrivateLinkResource>)result.Value, null, response);
47+
}
48+
49+
/// <summary> Get next page. </summary>
50+
/// <param name="pageSizeHint"> The number of items per page. </param>
51+
/// <param name="continuationToken"> A continuation token indicating where to resume paging. </param>
52+
private Response GetNextResponse(int? pageSizeHint, string continuationToken)
53+
{
54+
HttpMessage message = _client.CreateGetByStorageSyncServiceRequest(_subscriptionId, _resourceGroupName, _storageSyncServiceName, _context);
55+
using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("StorageSyncServiceResource.GetByStorageSyncService");
56+
scope.Start();
57+
try
58+
{
59+
return _client.Pipeline.ProcessMessage(message, _context);
60+
}
61+
catch (Exception e)
62+
{
63+
scope.Failed(e);
64+
throw;
65+
}
66+
}
67+
}
68+
}

sdk/storagesync/Azure.ResourceManager.StorageSync/src/Custom/Models/StorageSyncNameAvailabilityContent.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
#nullable disable
55

66
using System;
7-
using Azure.Core;
87

98
namespace Azure.ResourceManager.StorageSync.Models
109
{
1110
/// <summary> Parameters for a check name availability request. </summary>
12-
[CodeGenSuppress("StorageSyncNameAvailabilityContent", typeof(string))]
1311
public partial class StorageSyncNameAvailabilityContent
1412
{
1513
/// <summary> Initializes a new instance of StorageSyncNameAvailabilityContent. </summary>

sdk/storagesync/Azure.ResourceManager.StorageSync/src/Custom/Models/StorageSyncResourceType.cs

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,13 @@
33

44
#nullable disable
55

6-
using System;
7-
using System.ComponentModel;
8-
using Azure.Core;
9-
10-
[assembly:CodeGenSuppressType("StorageSyncResourceType")]
116
namespace Azure.ResourceManager.StorageSync.Models
127
{
138
/// <summary> The resource type. Must be set to Microsoft.StorageSync/storageSyncServices. </summary>
14-
public readonly partial struct StorageSyncResourceType : IEquatable<StorageSyncResourceType>
9+
[Microsoft.TypeSpec.Generator.Customizations.CodeGenType("StorageSyncResourceType")]
10+
public readonly partial struct StorageSyncResourceType
1511
{
16-
private readonly string _value;
17-
18-
/// <summary> Initializes a new instance of <see cref="StorageSyncResourceType"/>. </summary>
19-
/// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
20-
public StorageSyncResourceType(string value)
21-
{
22-
_value = value ?? throw new ArgumentNullException(nameof(value));
23-
}
24-
#pragma warning disable CA1707
25-
private const string Microsoft_StorageSync_StorageSyncServicesValue = "Microsoft.StorageSync/storageSyncServices";
26-
27-
/// <summary> Microsoft.StorageSync/storageSyncServices. </summary>
28-
public static StorageSyncResourceType Microsoft_StorageSync_StorageSyncServices { get; } = new StorageSyncResourceType(Microsoft_StorageSync_StorageSyncServicesValue);
29-
#pragma warning restore CA1707
30-
/// <summary> Determines if two <see cref="StorageSyncResourceType"/> values are the same. </summary>
31-
public static bool operator ==(StorageSyncResourceType left, StorageSyncResourceType right) => left.Equals(right);
32-
/// <summary> Determines if two <see cref="StorageSyncResourceType"/> values are not the same. </summary>
33-
public static bool operator !=(StorageSyncResourceType left, StorageSyncResourceType right) => !left.Equals(right);
34-
/// <summary> Converts a string to a <see cref="StorageSyncResourceType"/>. </summary>
35-
public static implicit operator StorageSyncResourceType(string value) => new StorageSyncResourceType(value);
36-
37-
/// <inheritdoc />
38-
[EditorBrowsable(EditorBrowsableState.Never)]
39-
public override bool Equals(object obj) => obj is StorageSyncResourceType other && Equals(other);
40-
/// <inheritdoc />
41-
public bool Equals(StorageSyncResourceType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
42-
43-
/// <inheritdoc />
44-
[EditorBrowsable(EditorBrowsableState.Never)]
45-
public override int GetHashCode() => _value?.GetHashCode() ?? 0;
46-
/// <inheritdoc />
47-
public override string ToString() => _value;
12+
/// <summary> Gets the Microsoft_StorageSync_StorageSyncServices. </summary>
13+
public static StorageSyncResourceType Microsoft_StorageSync_StorageSyncServices { get; } = new StorageSyncResourceType(MicrosoftStorageSyncStorageSyncServicesValue);
4814
}
4915
}

0 commit comments

Comments
 (0)