forked from Azure/azure-sdk-for-net
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.NET SDK changes for 05-15 stable API version. (Azure#30573)
- Loading branch information
1 parent
9b44543
commit 062b362
Showing
292 changed files
with
134,102 additions
and
108,479 deletions.
There are no files selected for viewing
187 changes: 187 additions & 0 deletions
187
...mosdb/Azure.ResourceManager.CosmosDB/api/Azure.ResourceManager.CosmosDB.netstandard2.0.cs
Large diffs are not rendered by default.
Oops, something went wrong.
122 changes: 122 additions & 0 deletions
122
sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Custom/RestorableCosmosDBAccountResource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#nullable disable | ||
|
||
using System; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Azure.Core; | ||
using Azure.ResourceManager.CosmosDB.Models; | ||
|
||
namespace Azure.ResourceManager.CosmosDB | ||
{ | ||
/// <summary> | ||
/// A Class representing a RestorableCosmosDBAccount along with the instance operations that can be performed on it. | ||
/// If you have a <see cref="ResourceIdentifier" /> you can construct a <see cref="RestorableCosmosDBAccountResource" /> | ||
/// from an instance of <see cref="ArmClient" /> using the GetRestorableCosmosDBAccountResource method. | ||
/// Otherwise you can get one from its parent resource <see cref="CosmosDBLocationResource" /> using the GetRestorableCosmosDBAccount method. | ||
/// </summary> | ||
public partial class RestorableCosmosDBAccountResource : ArmResource | ||
{ | ||
[Obsolete("This function is obsolete and will be removed in a future release.", false)] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public virtual Pageable<DatabaseRestoreResourceInfo> GetRestorableMongoDBResources(AzureLocation? restoreLocation = null, string restoreTimestampInUtc = null, CancellationToken cancellationToken = default) | ||
{ | ||
Page<DatabaseRestoreResourceInfo> FirstPageFunc(int? pageSizeHint) | ||
{ | ||
using var scope = _restorableMongoDBResourcesClientDiagnostics.CreateScope("RestorableCosmosDBAccountResource.GetRestorableMongoDBResources"); | ||
scope.Start(); | ||
try | ||
{ | ||
var response = _restorableMongoDBResourcesRestClient.List(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Guid.Parse(Id.Name), restoreLocation, restoreTimestampInUtc, cancellationToken: cancellationToken); | ||
return Page.FromValues(response.Value.Value.Select(x => ConvertFromRestorableMongoDBResourceData(x)), null, response.GetRawResponse()); | ||
} | ||
catch (Exception e) | ||
{ | ||
scope.Failed(e); | ||
throw; | ||
} | ||
} | ||
return PageableHelpers.CreateEnumerable(FirstPageFunc, null); | ||
} | ||
|
||
[Obsolete("This function is obsolete and will be removed in a future release.", false)] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public virtual AsyncPageable<DatabaseRestoreResourceInfo> GetRestorableMongoDBResourcesAsync(AzureLocation? restoreLocation = null, string restoreTimestampInUtc = null, CancellationToken cancellationToken = default) | ||
{ | ||
async Task<Page<DatabaseRestoreResourceInfo>> FirstPageFunc(int? pageSizeHint) | ||
{ | ||
using var scope = _restorableMongoDBResourcesClientDiagnostics.CreateScope("RestorableCosmosDBAccountResource.GetRestorableMongoDBResources"); | ||
scope.Start(); | ||
try | ||
{ | ||
var response = await _restorableMongoDBResourcesRestClient.ListAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Guid.Parse(Id.Name), restoreLocation, restoreTimestampInUtc, cancellationToken: cancellationToken).ConfigureAwait(false); | ||
return Page.FromValues(response.Value.Value.Select(x => ConvertFromRestorableMongoDBResourceData(x)), null, response.GetRawResponse()); | ||
} | ||
catch (Exception e) | ||
{ | ||
scope.Failed(e); | ||
throw; | ||
} | ||
} | ||
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); | ||
} | ||
|
||
[Obsolete("This function is obsolete and will be removed in a future release.", false)] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public virtual AsyncPageable<DatabaseRestoreResourceInfo> GetRestorableSqlResourcesAsync(AzureLocation? restoreLocation = null, string restoreTimestampInUtc = null, CancellationToken cancellationToken = default) | ||
{ | ||
async Task<Page<DatabaseRestoreResourceInfo>> FirstPageFunc(int? pageSizeHint) | ||
{ | ||
using var scope = _restorableSqlResourcesClientDiagnostics.CreateScope("RestorableCosmosDBAccountResource.GetRestorableSqlResources"); | ||
scope.Start(); | ||
try | ||
{ | ||
var response = await _restorableSqlResourcesRestClient.ListAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Guid.Parse(Id.Name), restoreLocation, restoreTimestampInUtc, cancellationToken: cancellationToken).ConfigureAwait(false); | ||
return Page.FromValues(response.Value.Value.Select(x => ConvertFromRestorableSqlResourceData(x)), null, response.GetRawResponse()); | ||
} | ||
catch (Exception e) | ||
{ | ||
scope.Failed(e); | ||
throw; | ||
} | ||
} | ||
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); | ||
} | ||
|
||
[Obsolete("This function is obsolete and will be removed in a future release.", false)] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public virtual Pageable<DatabaseRestoreResourceInfo> GetRestorableSqlResources(AzureLocation? restoreLocation = null, string restoreTimestampInUtc = null, CancellationToken cancellationToken = default) | ||
{ | ||
Page<DatabaseRestoreResourceInfo> FirstPageFunc(int? pageSizeHint) | ||
{ | ||
using var scope = _restorableSqlResourcesClientDiagnostics.CreateScope("RestorableCosmosDBAccountResource.GetRestorableSqlResources"); | ||
scope.Start(); | ||
try | ||
{ | ||
var response = _restorableSqlResourcesRestClient.List(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Guid.Parse(Id.Name), restoreLocation, restoreTimestampInUtc, cancellationToken: cancellationToken); | ||
return Page.FromValues(response.Value.Value.Select(x => ConvertFromRestorableSqlResourceData(x)), null, response.GetRawResponse()); | ||
} | ||
catch (Exception e) | ||
{ | ||
scope.Failed(e); | ||
throw; | ||
} | ||
} | ||
return PageableHelpers.CreateEnumerable(FirstPageFunc, null); | ||
} | ||
|
||
private static DatabaseRestoreResourceInfo ConvertFromRestorableMongoDBResourceData(RestorableMongoDBResourceData value) | ||
{ | ||
return new DatabaseRestoreResourceInfo(value.DatabaseName, value.CollectionNames.ToList()); | ||
} | ||
|
||
private static DatabaseRestoreResourceInfo ConvertFromRestorableSqlResourceData(RestorableSqlResourceData value) | ||
{ | ||
return new DatabaseRestoreResourceInfo(value.DatabaseName, value.CollectionNames.ToList()); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountResource.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.