Skip to content

Commit 4773fed

Browse files
Managed database cross subscription restore (#20735)
* SDK generated from private branch, and added support for cross subscription restore * recording tests * help, changelog * split example in two * fixing * Removing positional parameter to fix pipeline * Use commit hash --------- Co-authored-by: Milan Brkic <mibrkic@microsoft.com>
1 parent 459b6f6 commit 4773fed

26 files changed

+11482
-8875
lines changed

src/Sql/Sql.Sdk/Generated/ISqlManagementClient.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -438,16 +438,6 @@ public partial interface ISqlManagementClient : System.IDisposable
438438
/// </summary>
439439
IIPv6FirewallRulesOperations IPv6FirewallRules { get; }
440440

441-
/// <summary>
442-
/// Gets the IManagedDatabaseRestoreDetailsOperations.
443-
/// </summary>
444-
IManagedDatabaseRestoreDetailsOperations ManagedDatabaseRestoreDetails { get; }
445-
446-
/// <summary>
447-
/// Gets the IManagedDatabasesOperations.
448-
/// </summary>
449-
IManagedDatabasesOperations ManagedDatabases { get; }
450-
451441
/// <summary>
452442
/// Gets the IReplicationLinksOperations.
453443
/// </summary>
@@ -483,5 +473,15 @@ public partial interface ISqlManagementClient : System.IDisposable
483473
/// </summary>
484474
IManagedServerDnsAliasesOperations ManagedServerDnsAliases { get; }
485475

476+
/// <summary>
477+
/// Gets the IManagedDatabasesOperations.
478+
/// </summary>
479+
IManagedDatabasesOperations ManagedDatabases { get; }
480+
481+
/// <summary>
482+
/// Gets the IManagedDatabaseRestoreDetailsOperations.
483+
/// </summary>
484+
IManagedDatabaseRestoreDetailsOperations ManagedDatabaseRestoreDetails { get; }
485+
486486
}
487487
}

src/Sql/Sql.Sdk/Generated/ManagedDatabaseRestoreDetailsOperations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ internal ManagedDatabaseRestoreDetailsOperations(SqlManagementClient client)
103103
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
104104
}
105105
string restoreDetailsName = "Default";
106-
string apiVersion = "2022-02-01-preview";
106+
string apiVersion = "2022-05-01-preview";
107107
// Tracing
108108
bool _shouldTrace = ServiceClientTracing.IsEnabled;
109109
string _invocationId = null;

src/Sql/Sql.Sdk/Generated/ManagedDatabasesOperations.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client)
9595
{
9696
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
9797
}
98-
string apiVersion = "2022-02-01-preview";
98+
string apiVersion = "2022-05-01-preview";
9999
// Tracing
100100
bool _shouldTrace = ServiceClientTracing.IsEnabled;
101101
string _invocationId = null;
@@ -297,7 +297,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client)
297297
{
298298
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
299299
}
300-
string apiVersion = "2022-02-01-preview";
300+
string apiVersion = "2022-05-01-preview";
301301
// Tracing
302302
bool _shouldTrace = ServiceClientTracing.IsEnabled;
303303
string _invocationId = null;
@@ -694,7 +694,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client)
694694
{
695695
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
696696
}
697-
string apiVersion = "2022-02-01-preview";
697+
string apiVersion = "2022-05-01-preview";
698698
// Tracing
699699
bool _shouldTrace = ServiceClientTracing.IsEnabled;
700700
string _invocationId = null;
@@ -907,7 +907,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client)
907907
{
908908
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
909909
}
910-
string apiVersion = "2022-02-01-preview";
910+
string apiVersion = "2022-05-01-preview";
911911
// Tracing
912912
bool _shouldTrace = ServiceClientTracing.IsEnabled;
913913
string _invocationId = null;
@@ -1133,7 +1133,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client)
11331133
{
11341134
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
11351135
}
1136-
string apiVersion = "2022-02-01-preview";
1136+
string apiVersion = "2022-05-01-preview";
11371137
// Tracing
11381138
bool _shouldTrace = ServiceClientTracing.IsEnabled;
11391139
string _invocationId = null;
@@ -1326,7 +1326,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client)
13261326
{
13271327
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
13281328
}
1329-
string apiVersion = "2022-02-01-preview";
1329+
string apiVersion = "2022-05-01-preview";
13301330
// Tracing
13311331
bool _shouldTrace = ServiceClientTracing.IsEnabled;
13321332
string _invocationId = null;
@@ -1545,7 +1545,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client)
15451545
{
15461546
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
15471547
}
1548-
string apiVersion = "2022-02-01-preview";
1548+
string apiVersion = "2022-05-01-preview";
15491549
// Tracing
15501550
bool _shouldTrace = ServiceClientTracing.IsEnabled;
15511551
string _invocationId = null;
@@ -1746,7 +1746,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client)
17461746
{
17471747
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
17481748
}
1749-
string apiVersion = "2022-02-01-preview";
1749+
string apiVersion = "2022-05-01-preview";
17501750
// Tracing
17511751
bool _shouldTrace = ServiceClientTracing.IsEnabled;
17521752
string _invocationId = null;
@@ -1947,7 +1947,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client)
19471947
{
19481948
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
19491949
}
1950-
string apiVersion = "2022-02-01-preview";
1950+
string apiVersion = "2022-05-01-preview";
19511951
// Tracing
19521952
bool _shouldTrace = ServiceClientTracing.IsEnabled;
19531953
string _invocationId = null;
@@ -2148,7 +2148,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client)
21482148
{
21492149
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
21502150
}
2151-
string apiVersion = "2022-02-01-preview";
2151+
string apiVersion = "2022-05-01-preview";
21522152
// Tracing
21532153
bool _shouldTrace = ServiceClientTracing.IsEnabled;
21542154
string _invocationId = null;

src/Sql/Sql.Sdk/Generated/Models/ManagedDatabase.cs

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ public ManagedDatabase()
4242
/// <param name="collation">Collation of the managed database.</param>
4343
/// <param name="status">Status of the database. Possible values
4444
/// include: 'Online', 'Offline', 'Shutdown', 'Creating',
45-
/// 'Inaccessible', 'Restoring', 'Updating'</param>
45+
/// 'Inaccessible', 'Restoring', 'Updating', 'Stopping', 'Stopped',
46+
/// 'Starting', 'DbMoving', 'DbCopying'</param>
4647
/// <param name="creationDate">Creation date of the database.</param>
4748
/// <param name="earliestRestorePoint">Earliest restore point in time
4849
/// for point in time restore.</param>
@@ -75,9 +76,15 @@ public ManagedDatabase()
7576
/// <param name="sourceDatabaseId">The resource identifier of the
7677
/// source database associated with create operation of this
7778
/// database.</param>
79+
/// <param name="crossSubscriptionSourceDatabaseId">The resource
80+
/// identifier of the cross-subscription source database associated
81+
/// with create operation of this database.</param>
7882
/// <param name="restorableDroppedDatabaseId">The restorable dropped
7983
/// database resource id to restore when creating this
8084
/// database.</param>
85+
/// <param name="crossSubscriptionRestorableDroppedDatabaseId">The
86+
/// restorable cross-subscription dropped database resource id to
87+
/// restore when creating this database.</param>
8188
/// <param name="storageContainerIdentity">Conditional. If createMode
8289
/// is RestoreExternalBackup, this value is used. Specifies the
8390
/// identity used for storage container authentication. Can be
@@ -99,7 +106,9 @@ public ManagedDatabase()
99106
/// of this managed database.</param>
100107
/// <param name="lastBackupName">Last backup file name for restore of
101108
/// this managed database.</param>
102-
public ManagedDatabase(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), string collation = default(string), string status = default(string), System.DateTime? creationDate = default(System.DateTime?), System.DateTime? earliestRestorePoint = default(System.DateTime?), System.DateTime? restorePointInTime = default(System.DateTime?), string defaultSecondaryLocation = default(string), string catalogCollation = default(string), string createMode = default(string), string storageContainerUri = default(string), string sourceDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string storageContainerIdentity = default(string), string storageContainerSasToken = default(string), string failoverGroupId = default(string), string recoverableDatabaseId = default(string), string longTermRetentionBackupResourceId = default(string), bool? autoCompleteRestore = default(bool?), string lastBackupName = default(string))
109+
/// <param name="crossSubscriptionTargetManagedInstanceId">Target
110+
/// managed instance id used in cross-subscription restore.</param>
111+
public ManagedDatabase(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), string collation = default(string), string status = default(string), System.DateTime? creationDate = default(System.DateTime?), System.DateTime? earliestRestorePoint = default(System.DateTime?), System.DateTime? restorePointInTime = default(System.DateTime?), string defaultSecondaryLocation = default(string), string catalogCollation = default(string), string createMode = default(string), string storageContainerUri = default(string), string sourceDatabaseId = default(string), string crossSubscriptionSourceDatabaseId = default(string), string restorableDroppedDatabaseId = default(string), string crossSubscriptionRestorableDroppedDatabaseId = default(string), string storageContainerIdentity = default(string), string storageContainerSasToken = default(string), string failoverGroupId = default(string), string recoverableDatabaseId = default(string), string longTermRetentionBackupResourceId = default(string), bool? autoCompleteRestore = default(bool?), string lastBackupName = default(string), string crossSubscriptionTargetManagedInstanceId = default(string))
103112
: base(location, id, name, type, tags)
104113
{
105114
Collation = collation;
@@ -112,14 +121,17 @@ public ManagedDatabase()
112121
CreateMode = createMode;
113122
StorageContainerUri = storageContainerUri;
114123
SourceDatabaseId = sourceDatabaseId;
124+
CrossSubscriptionSourceDatabaseId = crossSubscriptionSourceDatabaseId;
115125
RestorableDroppedDatabaseId = restorableDroppedDatabaseId;
126+
CrossSubscriptionRestorableDroppedDatabaseId = crossSubscriptionRestorableDroppedDatabaseId;
116127
StorageContainerIdentity = storageContainerIdentity;
117128
StorageContainerSasToken = storageContainerSasToken;
118129
FailoverGroupId = failoverGroupId;
119130
RecoverableDatabaseId = recoverableDatabaseId;
120131
LongTermRetentionBackupResourceId = longTermRetentionBackupResourceId;
121132
AutoCompleteRestore = autoCompleteRestore;
122133
LastBackupName = lastBackupName;
134+
CrossSubscriptionTargetManagedInstanceId = crossSubscriptionTargetManagedInstanceId;
123135
CustomInit();
124136
}
125137

@@ -137,7 +149,8 @@ public ManagedDatabase()
137149
/// <summary>
138150
/// Gets status of the database. Possible values include: 'Online',
139151
/// 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Restoring',
140-
/// 'Updating'
152+
/// 'Updating', 'Stopping', 'Stopped', 'Starting', 'DbMoving',
153+
/// 'DbCopying'
141154
/// </summary>
142155
[JsonProperty(PropertyName = "properties.status")]
143156
public string Status { get; private set; }
@@ -209,13 +222,27 @@ public ManagedDatabase()
209222
[JsonProperty(PropertyName = "properties.sourceDatabaseId")]
210223
public string SourceDatabaseId { get; set; }
211224

225+
/// <summary>
226+
/// Gets or sets the resource identifier of the cross-subscription
227+
/// source database associated with create operation of this database.
228+
/// </summary>
229+
[JsonProperty(PropertyName = "properties.crossSubscriptionSourceDatabaseId")]
230+
public string CrossSubscriptionSourceDatabaseId { get; set; }
231+
212232
/// <summary>
213233
/// Gets or sets the restorable dropped database resource id to restore
214234
/// when creating this database.
215235
/// </summary>
216236
[JsonProperty(PropertyName = "properties.restorableDroppedDatabaseId")]
217237
public string RestorableDroppedDatabaseId { get; set; }
218238

239+
/// <summary>
240+
/// Gets or sets the restorable cross-subscription dropped database
241+
/// resource id to restore when creating this database.
242+
/// </summary>
243+
[JsonProperty(PropertyName = "properties.crossSubscriptionRestorableDroppedDatabaseId")]
244+
public string CrossSubscriptionRestorableDroppedDatabaseId { get; set; }
245+
219246
/// <summary>
220247
/// Gets or sets conditional. If createMode is RestoreExternalBackup,
221248
/// this value is used. Specifies the identity used for storage
@@ -269,6 +296,13 @@ public ManagedDatabase()
269296
[JsonProperty(PropertyName = "properties.lastBackupName")]
270297
public string LastBackupName { get; set; }
271298

299+
/// <summary>
300+
/// Gets or sets target managed instance id used in cross-subscription
301+
/// restore.
302+
/// </summary>
303+
[JsonProperty(PropertyName = "properties.crossSubscriptionTargetManagedInstanceId")]
304+
public string CrossSubscriptionTargetManagedInstanceId { get; set; }
305+
272306
/// <summary>
273307
/// Validate the object.
274308
/// </summary>

src/Sql/Sql.Sdk/Generated/Models/ManagedDatabaseStatus.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,10 @@ public static class ManagedDatabaseStatus
2323
public const string Inaccessible = "Inaccessible";
2424
public const string Restoring = "Restoring";
2525
public const string Updating = "Updating";
26+
public const string Stopping = "Stopping";
27+
public const string Stopped = "Stopped";
28+
public const string Starting = "Starting";
29+
public const string DbMoving = "DbMoving";
30+
public const string DbCopying = "DbCopying";
2631
}
2732
}

0 commit comments

Comments
 (0)