diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/api/Azure.ResourceManager.DataProtectionBackup.netstandard2.0.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/api/Azure.ResourceManager.DataProtectionBackup.netstandard2.0.cs index 13b56538d34e5..ffb9cde9e9529 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/api/Azure.ResourceManager.DataProtectionBackup.netstandard2.0.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/api/Azure.ResourceManager.DataProtectionBackup.netstandard2.0.cs @@ -19,6 +19,7 @@ public static partial class DataProtectionBackupExtensions public static Azure.ResourceManager.DataProtectionBackup.DeletedDataProtectionBackupInstanceResource GetDeletedDataProtectionBackupInstanceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.Response GetResourceGuard(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string resourceGuardsName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetResourceGuardAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string resourceGuardsName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DataProtectionBackup.ResourceGuardProxyBaseResource GetResourceGuardProxyBaseResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.DataProtectionBackup.ResourceGuardResource GetResourceGuardResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.DataProtectionBackup.ResourceGuardCollection GetResourceGuards(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetResourceGuards(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -225,6 +226,9 @@ protected DataProtectionBackupVaultResource() { } public virtual Azure.Response GetDeletedDataProtectionBackupInstance(string backupInstanceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetDeletedDataProtectionBackupInstanceAsync(string backupInstanceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.DataProtectionBackup.DeletedDataProtectionBackupInstanceCollection GetDeletedDataProtectionBackupInstances() { throw null; } + public virtual Azure.Response GetResourceGuardProxyBaseResource(string resourceGuardProxyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetResourceGuardProxyBaseResourceAsync(string resourceGuardProxyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DataProtectionBackup.ResourceGuardProxyBaseResourceCollection GetResourceGuardProxyBaseResources() { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -296,6 +300,42 @@ public ResourceGuardData(Azure.Core.AzureLocation location) : base (default(Azur public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.DataProtectionBackup.Models.ResourceGuardProperties Properties { get { throw null; } set { } } } + public partial class ResourceGuardProxyBaseResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ResourceGuardProxyBaseResource() { } + public virtual Azure.ResourceManager.DataProtectionBackup.ResourceGuardProxyBaseResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UnlockDelete(Azure.ResourceManager.DataProtectionBackup.Models.UnlockDeleteContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UnlockDeleteAsync(Azure.ResourceManager.DataProtectionBackup.Models.UnlockDeleteContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DataProtectionBackup.ResourceGuardProxyBaseResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DataProtectionBackup.ResourceGuardProxyBaseResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ResourceGuardProxyBaseResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ResourceGuardProxyBaseResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string resourceGuardProxyName, Azure.ResourceManager.DataProtectionBackup.ResourceGuardProxyBaseResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string resourceGuardProxyName, Azure.ResourceManager.DataProtectionBackup.ResourceGuardProxyBaseResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string resourceGuardProxyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string resourceGuardProxyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string resourceGuardProxyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceGuardProxyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class ResourceGuardProxyBaseResourceData : Azure.ResourceManager.Models.ResourceData + { + public ResourceGuardProxyBaseResourceData() { } + public Azure.ResourceManager.DataProtectionBackup.Models.ResourceGuardProxyBase Properties { get { throw null; } set { } } + } public partial class ResourceGuardResource : Azure.ResourceManager.ArmResource { public static readonly Azure.Core.ResourceType ResourceType; @@ -1207,6 +1247,7 @@ public ItemPathBasedRestoreCriteria(string itemPath, bool isPathRelativeToBackup public partial class KubernetesClusterBackupDataSourceSettings : Azure.ResourceManager.DataProtectionBackup.Models.BackupDataSourceSettings { public KubernetesClusterBackupDataSourceSettings(bool isSnapshotVolumesEnabled, bool isClusterScopeResourcesIncluded) { } + public System.Collections.Generic.IList BackupHookReferences { get { throw null; } } public System.Collections.Generic.IList ExcludedNamespaces { get { throw null; } } public System.Collections.Generic.IList ExcludedResourceTypes { get { throw null; } } public System.Collections.Generic.IList IncludedNamespaces { get { throw null; } } @@ -1227,6 +1268,7 @@ public KubernetesClusterRestoreCriteria(bool isClusterScopeResourcesIncluded) { public System.Collections.Generic.IList LabelSelectors { get { throw null; } } public System.Collections.Generic.IDictionary NamespaceMappings { get { throw null; } } public Azure.ResourceManager.DataProtectionBackup.Models.PersistentVolumeRestoreMode? PersistentVolumeRestoreMode { get { throw null; } set { } } + public System.Collections.Generic.IList RestoreHookReferences { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct KubernetesClusterRestoreExistingResourcePolicy : System.IEquatable @@ -1258,6 +1300,12 @@ public KubernetesStorageClassRestoreCriteria() { } public string Provisioner { get { throw null; } set { } } public string SelectedStorageClassName { get { throw null; } set { } } } + public partial class NamespacedNameResource + { + public NamespacedNameResource() { } + public string Name { get { throw null; } set { } } + public string Namespace { get { throw null; } set { } } + } public partial class OperationalDataStoreSettings : Azure.ResourceManager.DataProtectionBackup.Models.DataStoreSettings { public OperationalDataStoreSettings(Azure.ResourceManager.DataProtectionBackup.Models.DataStoreType dataStoreType) : base (default(Azure.ResourceManager.DataProtectionBackup.Models.DataStoreType)) { } @@ -1338,6 +1386,12 @@ public RecoveryPointDataStoreDetail() { } public static bool operator !=(Azure.ResourceManager.DataProtectionBackup.Models.RecoverySetting left, Azure.ResourceManager.DataProtectionBackup.Models.RecoverySetting right) { throw null; } public override string ToString() { throw null; } } + public partial class ResourceGuardOperationDetail + { + public ResourceGuardOperationDetail() { } + public string DefaultResourceRequest { get { throw null; } set { } } + public string VaultCriticalOperation { get { throw null; } set { } } + } public partial class ResourceGuardOperationDetails { internal ResourceGuardOperationDetails() { } @@ -1362,6 +1416,14 @@ public partial class ResourceGuardProtectedObjectData : Azure.ResourceManager.Mo { internal ResourceGuardProtectedObjectData() { } } + public partial class ResourceGuardProxyBase + { + public ResourceGuardProxyBase() { } + public string Description { get { throw null; } set { } } + public string LastUpdatedTime { get { throw null; } set { } } + public System.Collections.Generic.IList ResourceGuardOperationDetails { get { throw null; } } + public string ResourceGuardResourceId { get { throw null; } set { } } + } public partial class RestorableTimeRange { public RestorableTimeRange(System.DateTimeOffset startOn, System.DateTimeOffset endOn) { } @@ -1564,4 +1626,15 @@ public TargetCopySetting(Azure.ResourceManager.DataProtectionBackup.Models.DataP public Azure.ResourceManager.DataProtectionBackup.Models.DataProtectionBackupCopySetting CopyAfter { get { throw null; } set { } } public Azure.ResourceManager.DataProtectionBackup.Models.DataStoreInfoBase DataStore { get { throw null; } set { } } } + public partial class UnlockDeleteContent + { + public UnlockDeleteContent() { } + public System.Collections.Generic.IList ResourceGuardOperationRequests { get { throw null; } } + public string ResourceToBeDeleted { get { throw null; } set { } } + } + public partial class UnlockDeleteResponse + { + internal UnlockDeleteResponse() { } + public string UnlockDeleteExpiryTime { get { throw null; } } + } } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultResource.cs index 6a29b28f331ad..90deae40c8504 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultResource.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultResource.cs @@ -310,6 +310,59 @@ public virtual Response GetDeletedD return GetDeletedDataProtectionBackupInstances().Get(backupInstanceName, cancellationToken); } + /// Gets a collection of ResourceGuardProxyBaseResources in the DataProtectionBackupVault. + /// An object representing collection of ResourceGuardProxyBaseResources and their operations over a ResourceGuardProxyBaseResource. + public virtual ResourceGuardProxyBaseResourceCollection GetResourceGuardProxyBaseResources() + { + return GetCachedClient(Client => new ResourceGuardProxyBaseResourceCollection(Client, Id)); + } + + /// + /// Returns the ResourceGuardProxy object associated with the vault, and that matches the name in the request + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_Get + /// + /// + /// + /// name of the resource guard proxy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetResourceGuardProxyBaseResourceAsync(string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + return await GetResourceGuardProxyBaseResources().GetAsync(resourceGuardProxyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the ResourceGuardProxy object associated with the vault, and that matches the name in the request + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_Get + /// + /// + /// + /// name of the resource guard proxy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetResourceGuardProxyBaseResource(string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + return GetResourceGuardProxyBaseResources().Get(resourceGuardProxyName, cancellationToken); + } + /// /// Returns a resource belonging to a resource group. /// diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/DataProtectionBackupExtensions.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/DataProtectionBackupExtensions.cs index 4fe3471e559a7..cc6d533895be7 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/DataProtectionBackupExtensions.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/DataProtectionBackupExtensions.cs @@ -183,6 +183,25 @@ public static ResourceGuardResource GetResourceGuardResource(this ArmClient clie } #endregion + #region ResourceGuardProxyBaseResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ResourceGuardProxyBaseResource GetResourceGuardProxyBaseResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ResourceGuardProxyBaseResource.ValidateResourceId(id); + return new ResourceGuardProxyBaseResource(client, id); + } + ); + } + #endregion + /// Gets a collection of DataProtectionBackupVaultResources in the ResourceGroupResource. /// The instance the method will execute against. /// An object representing collection of DataProtectionBackupVaultResources and their operations over a DataProtectionBackupVaultResource. diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterBackupDataSourceSettings.Serialization.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterBackupDataSourceSettings.Serialization.cs index f30801bf36252..a6d4a3453c8b1 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterBackupDataSourceSettings.Serialization.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterBackupDataSourceSettings.Serialization.cs @@ -70,6 +70,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsCollectionDefined(BackupHookReferences)) + { + writer.WritePropertyName("backupHookReferences"u8); + writer.WriteStartArray(); + foreach (var item in BackupHookReferences) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } writer.WritePropertyName("objectType"u8); writer.WriteStringValue(ObjectType); writer.WriteEndObject(); @@ -88,6 +98,7 @@ internal static KubernetesClusterBackupDataSourceSettings DeserializeKubernetesC Optional> includedResourceTypes = default; Optional> excludedResourceTypes = default; Optional> labelSelectors = default; + Optional> backupHookReferences = default; string objectType = default; foreach (var property in element.EnumerateObject()) { @@ -171,13 +182,27 @@ internal static KubernetesClusterBackupDataSourceSettings DeserializeKubernetesC labelSelectors = array; continue; } + if (property.NameEquals("backupHookReferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NamespacedNameResource.DeserializeNamespacedNameResource(item)); + } + backupHookReferences = array; + continue; + } if (property.NameEquals("objectType"u8)) { objectType = property.Value.GetString(); continue; } } - return new KubernetesClusterBackupDataSourceSettings(objectType, snapshotVolumes, includeClusterScopeResources, Optional.ToList(includedNamespaces), Optional.ToList(excludedNamespaces), Optional.ToList(includedResourceTypes), Optional.ToList(excludedResourceTypes), Optional.ToList(labelSelectors)); + return new KubernetesClusterBackupDataSourceSettings(objectType, snapshotVolumes, includeClusterScopeResources, Optional.ToList(includedNamespaces), Optional.ToList(excludedNamespaces), Optional.ToList(includedResourceTypes), Optional.ToList(excludedResourceTypes), Optional.ToList(labelSelectors), Optional.ToList(backupHookReferences)); } } } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterBackupDataSourceSettings.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterBackupDataSourceSettings.cs index 1cda51d1e86cb..a39b0b41bc32a 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterBackupDataSourceSettings.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterBackupDataSourceSettings.cs @@ -14,8 +14,8 @@ namespace Azure.ResourceManager.DataProtectionBackup.Models public partial class KubernetesClusterBackupDataSourceSettings : BackupDataSourceSettings { /// Initializes a new instance of KubernetesClusterBackupDataSourceSettings. - /// Gets or sets the volume snapshot property. This property if enabled will take volume snapshots during restore. - /// Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources during restore. + /// Gets or sets the volume snapshot property. This property if enabled will take volume snapshots during backup. + /// Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources during backup. public KubernetesClusterBackupDataSourceSettings(bool isSnapshotVolumesEnabled, bool isClusterScopeResourcesIncluded) { IsSnapshotVolumesEnabled = isSnapshotVolumesEnabled; @@ -25,19 +25,21 @@ public KubernetesClusterBackupDataSourceSettings(bool isSnapshotVolumesEnabled, IncludedResourceTypes = new ChangeTrackingList(); ExcludedResourceTypes = new ChangeTrackingList(); LabelSelectors = new ChangeTrackingList(); + BackupHookReferences = new ChangeTrackingList(); ObjectType = "KubernetesClusterBackupDatasourceParameters"; } /// Initializes a new instance of KubernetesClusterBackupDataSourceSettings. /// Type of the specific object - used for deserializing. - /// Gets or sets the volume snapshot property. This property if enabled will take volume snapshots during restore. - /// Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources during restore. - /// Gets or sets the include namespaces property. This property sets the namespaces to be included during restore. - /// Gets or sets the exclude namespaces property. This property sets the namespaces to be excluded during restore. - /// Gets or sets the include resource types property. This property sets the resource types to be included during restore. - /// Gets or sets the exclude resource types property. This property sets the resource types to be excluded during restore. - /// Gets or sets the LabelSelectors property. This property sets the resource with such label selectors to be included during restore. - internal KubernetesClusterBackupDataSourceSettings(string objectType, bool isSnapshotVolumesEnabled, bool isClusterScopeResourcesIncluded, IList includedNamespaces, IList excludedNamespaces, IList includedResourceTypes, IList excludedResourceTypes, IList labelSelectors) : base(objectType) + /// Gets or sets the volume snapshot property. This property if enabled will take volume snapshots during backup. + /// Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources during backup. + /// Gets or sets the include namespaces property. This property sets the namespaces to be included during backup. + /// Gets or sets the exclude namespaces property. This property sets the namespaces to be excluded during backup. + /// Gets or sets the include resource types property. This property sets the resource types to be included during backup. + /// Gets or sets the exclude resource types property. This property sets the resource types to be excluded during backup. + /// Gets or sets the LabelSelectors property. This property sets the resource with such label selectors to be included during backup. + /// Gets or sets the backup hook references. This property sets the hook reference to be executed during backup. + internal KubernetesClusterBackupDataSourceSettings(string objectType, bool isSnapshotVolumesEnabled, bool isClusterScopeResourcesIncluded, IList includedNamespaces, IList excludedNamespaces, IList includedResourceTypes, IList excludedResourceTypes, IList labelSelectors, IList backupHookReferences) : base(objectType) { IsSnapshotVolumesEnabled = isSnapshotVolumesEnabled; IsClusterScopeResourcesIncluded = isClusterScopeResourcesIncluded; @@ -46,22 +48,25 @@ internal KubernetesClusterBackupDataSourceSettings(string objectType, bool isSna IncludedResourceTypes = includedResourceTypes; ExcludedResourceTypes = excludedResourceTypes; LabelSelectors = labelSelectors; + BackupHookReferences = backupHookReferences; ObjectType = objectType ?? "KubernetesClusterBackupDatasourceParameters"; } - /// Gets or sets the volume snapshot property. This property if enabled will take volume snapshots during restore. + /// Gets or sets the volume snapshot property. This property if enabled will take volume snapshots during backup. public bool IsSnapshotVolumesEnabled { get; set; } - /// Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources during restore. + /// Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources during backup. public bool IsClusterScopeResourcesIncluded { get; set; } - /// Gets or sets the include namespaces property. This property sets the namespaces to be included during restore. + /// Gets or sets the include namespaces property. This property sets the namespaces to be included during backup. public IList IncludedNamespaces { get; } - /// Gets or sets the exclude namespaces property. This property sets the namespaces to be excluded during restore. + /// Gets or sets the exclude namespaces property. This property sets the namespaces to be excluded during backup. public IList ExcludedNamespaces { get; } - /// Gets or sets the include resource types property. This property sets the resource types to be included during restore. + /// Gets or sets the include resource types property. This property sets the resource types to be included during backup. public IList IncludedResourceTypes { get; } - /// Gets or sets the exclude resource types property. This property sets the resource types to be excluded during restore. + /// Gets or sets the exclude resource types property. This property sets the resource types to be excluded during backup. public IList ExcludedResourceTypes { get; } - /// Gets or sets the LabelSelectors property. This property sets the resource with such label selectors to be included during restore. + /// Gets or sets the LabelSelectors property. This property sets the resource with such label selectors to be included during backup. public IList LabelSelectors { get; } + /// Gets or sets the backup hook references. This property sets the hook reference to be executed during backup. + public IList BackupHookReferences { get; } } } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterRestoreCriteria.Serialization.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterRestoreCriteria.Serialization.cs index 3049432a33cb0..9b21fbf0cb5c1 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterRestoreCriteria.Serialization.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterRestoreCriteria.Serialization.cs @@ -88,6 +88,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } + if (Optional.IsCollectionDefined(RestoreHookReferences)) + { + writer.WritePropertyName("restoreHookReferences"u8); + writer.WriteStartArray(); + foreach (var item in RestoreHookReferences) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } writer.WritePropertyName("objectType"u8); writer.WriteStringValue(ObjectType); writer.WriteEndObject(); diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterRestoreCriteria.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterRestoreCriteria.cs index 7100dde8fbbbc..c8c88185ddf89 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterRestoreCriteria.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/KubernetesClusterRestoreCriteria.cs @@ -24,6 +24,7 @@ public KubernetesClusterRestoreCriteria(bool isClusterScopeResourcesIncluded) ExcludedResourceTypes = new ChangeTrackingList(); LabelSelectors = new ChangeTrackingList(); NamespaceMappings = new ChangeTrackingDictionary(); + RestoreHookReferences = new ChangeTrackingList(); ObjectType = "KubernetesClusterRestoreCriteria"; } @@ -45,5 +46,7 @@ public KubernetesClusterRestoreCriteria(bool isClusterScopeResourcesIncluded) public KubernetesClusterRestoreExistingResourcePolicy? ConflictPolicy { get; set; } /// Gets or sets the Namespace Mappings property. This property sets if namespace needs to be change during restore. public IDictionary NamespaceMappings { get; } + /// Gets or sets the restore hook references. This property sets the hook reference to be executed during restore. + public IList RestoreHookReferences { get; } } } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/NamespacedNameResource.Serialization.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/NamespacedNameResource.Serialization.cs new file mode 100644 index 0000000000000..4909e33615bac --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/NamespacedNameResource.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DataProtectionBackup.Models +{ + public partial class NamespacedNameResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Namespace)) + { + writer.WritePropertyName("namespace"u8); + writer.WriteStringValue(Namespace); + } + writer.WriteEndObject(); + } + + internal static NamespacedNameResource DeserializeNamespacedNameResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional @namespace = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + } + return new NamespacedNameResource(name.Value, @namespace.Value); + } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/NamespacedNameResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/NamespacedNameResource.cs new file mode 100644 index 0000000000000..8e6eda11e9f93 --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/NamespacedNameResource.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.DataProtectionBackup.Models +{ + /// Class to refer resources which contains namespace and name. + public partial class NamespacedNameResource + { + /// Initializes a new instance of NamespacedNameResource. + public NamespacedNameResource() + { + } + + /// Initializes a new instance of NamespacedNameResource. + /// Name of the resource. + /// Namespace in which the resource exists. + internal NamespacedNameResource(string name, string @namespace) + { + Name = name; + Namespace = @namespace; + } + + /// Name of the resource. + public string Name { get; set; } + /// Namespace in which the resource exists. + public string Namespace { get; set; } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardOperationDetail.Serialization.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardOperationDetail.Serialization.cs new file mode 100644 index 0000000000000..b39a20e8e82f9 --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardOperationDetail.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DataProtectionBackup.Models +{ + public partial class ResourceGuardOperationDetail : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(VaultCriticalOperation)) + { + writer.WritePropertyName("vaultCriticalOperation"u8); + writer.WriteStringValue(VaultCriticalOperation); + } + if (Optional.IsDefined(DefaultResourceRequest)) + { + writer.WritePropertyName("defaultResourceRequest"u8); + writer.WriteStringValue(DefaultResourceRequest); + } + writer.WriteEndObject(); + } + + internal static ResourceGuardOperationDetail DeserializeResourceGuardOperationDetail(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional vaultCriticalOperation = default; + Optional defaultResourceRequest = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vaultCriticalOperation"u8)) + { + vaultCriticalOperation = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultResourceRequest"u8)) + { + defaultResourceRequest = property.Value.GetString(); + continue; + } + } + return new ResourceGuardOperationDetail(vaultCriticalOperation.Value, defaultResourceRequest.Value); + } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardOperationDetail.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardOperationDetail.cs new file mode 100644 index 0000000000000..f564b90df0d35 --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardOperationDetail.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.DataProtectionBackup.Models +{ + /// VaultCritical Operation protected by a resource guard. + public partial class ResourceGuardOperationDetail + { + /// Initializes a new instance of ResourceGuardOperationDetail. + public ResourceGuardOperationDetail() + { + } + + /// Initializes a new instance of ResourceGuardOperationDetail. + /// + /// + internal ResourceGuardOperationDetail(string vaultCriticalOperation, string defaultResourceRequest) + { + VaultCriticalOperation = vaultCriticalOperation; + DefaultResourceRequest = defaultResourceRequest; + } + + /// Gets or sets the vault critical operation. + public string VaultCriticalOperation { get; set; } + /// Gets or sets the default resource request. + public string DefaultResourceRequest { get; set; } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBase.Serialization.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBase.Serialization.cs new file mode 100644 index 0000000000000..2012230ded7f7 --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBase.Serialization.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DataProtectionBackup.Models +{ + public partial class ResourceGuardProxyBase : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceGuardResourceId)) + { + writer.WritePropertyName("resourceGuardResourceId"u8); + writer.WriteStringValue(ResourceGuardResourceId); + } + if (Optional.IsCollectionDefined(ResourceGuardOperationDetails)) + { + writer.WritePropertyName("resourceGuardOperationDetails"u8); + writer.WriteStartArray(); + foreach (var item in ResourceGuardOperationDetails) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(LastUpdatedTime)) + { + writer.WritePropertyName("lastUpdatedTime"u8); + writer.WriteStringValue(LastUpdatedTime); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + + internal static ResourceGuardProxyBase DeserializeResourceGuardProxyBase(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional resourceGuardResourceId = default; + Optional> resourceGuardOperationDetails = default; + Optional lastUpdatedTime = default; + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceGuardResourceId"u8)) + { + resourceGuardResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGuardOperationDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceGuardOperationDetail.DeserializeResourceGuardOperationDetail(item)); + } + resourceGuardOperationDetails = array; + continue; + } + if (property.NameEquals("lastUpdatedTime"u8)) + { + lastUpdatedTime = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + } + return new ResourceGuardProxyBase(resourceGuardResourceId.Value, Optional.ToList(resourceGuardOperationDetails), lastUpdatedTime.Value, description.Value); + } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBase.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBase.cs new file mode 100644 index 0000000000000..3d891ee64afba --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBase.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DataProtectionBackup.Models +{ + /// ResourceGuardProxyBase object, used in ResourceGuardProxyBaseResource. + public partial class ResourceGuardProxyBase + { + /// Initializes a new instance of ResourceGuardProxyBase. + public ResourceGuardProxyBase() + { + ResourceGuardOperationDetails = new ChangeTrackingList(); + } + + /// Initializes a new instance of ResourceGuardProxyBase. + /// + /// + /// + /// + internal ResourceGuardProxyBase(string resourceGuardResourceId, IList resourceGuardOperationDetails, string lastUpdatedTime, string description) + { + ResourceGuardResourceId = resourceGuardResourceId; + ResourceGuardOperationDetails = resourceGuardOperationDetails; + LastUpdatedTime = lastUpdatedTime; + Description = description; + } + + /// Gets or sets the resource guard resource id. + public string ResourceGuardResourceId { get; set; } + /// Gets the resource guard operation details. + public IList ResourceGuardOperationDetails { get; } + /// Gets or sets the last updated time. + public string LastUpdatedTime { get; set; } + /// Gets or sets the description. + public string Description { get; set; } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBaseResourceData.Serialization.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBaseResourceData.Serialization.cs new file mode 100644 index 0000000000000..251f9050f0f5d --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBaseResourceData.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DataProtectionBackup.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DataProtectionBackup +{ + public partial class ResourceGuardProxyBaseResourceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static ResourceGuardProxyBaseResourceData DeserializeResourceGuardProxyBaseResourceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ResourceGuardProxyBase.DeserializeResourceGuardProxyBase(property.Value); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new ResourceGuardProxyBaseResourceData(id, name, type, systemData.Value, properties.Value); + } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBaseResourceList.Serialization.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBaseResourceList.Serialization.cs new file mode 100644 index 0000000000000..580d02ea07a39 --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBaseResourceList.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DataProtectionBackup; + +namespace Azure.ResourceManager.DataProtectionBackup.Models +{ + internal partial class ResourceGuardProxyBaseResourceList + { + internal static ResourceGuardProxyBaseResourceList DeserializeResourceGuardProxyBaseResourceList(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceGuardProxyBaseResourceData.DeserializeResourceGuardProxyBaseResourceData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ResourceGuardProxyBaseResourceList(nextLink.Value, Optional.ToList(value)); + } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBaseResourceList.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBaseResourceList.cs new file mode 100644 index 0000000000000..6d56ad8380adc --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/ResourceGuardProxyBaseResourceList.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DataProtectionBackup; + +namespace Azure.ResourceManager.DataProtectionBackup.Models +{ + /// List of ResourceGuardProxyBase resources. + internal partial class ResourceGuardProxyBaseResourceList : DppResourceList + { + /// Initializes a new instance of ResourceGuardProxyBaseResourceList. + internal ResourceGuardProxyBaseResourceList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ResourceGuardProxyBaseResourceList. + /// The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. + /// List of resources. + internal ResourceGuardProxyBaseResourceList(string nextLink, IReadOnlyList value) : base(nextLink) + { + Value = value; + } + + /// List of resources. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/UnlockDeleteContent.Serialization.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/UnlockDeleteContent.Serialization.cs new file mode 100644 index 0000000000000..0cf237e65f3d7 --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/UnlockDeleteContent.Serialization.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DataProtectionBackup.Models +{ + public partial class UnlockDeleteContent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(ResourceGuardOperationRequests)) + { + writer.WritePropertyName("resourceGuardOperationRequests"u8); + writer.WriteStartArray(); + foreach (var item in ResourceGuardOperationRequests) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ResourceToBeDeleted)) + { + writer.WritePropertyName("resourceToBeDeleted"u8); + writer.WriteStringValue(ResourceToBeDeleted); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/UnlockDeleteContent.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/UnlockDeleteContent.cs new file mode 100644 index 0000000000000..7ec3c1201fa84 --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/UnlockDeleteContent.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DataProtectionBackup.Models +{ + /// Request body of unlock delete API. + public partial class UnlockDeleteContent + { + /// Initializes a new instance of UnlockDeleteContent. + public UnlockDeleteContent() + { + ResourceGuardOperationRequests = new ChangeTrackingList(); + } + + /// Gets the resource guard operation requests. + public IList ResourceGuardOperationRequests { get; } + /// Gets or sets the resource to be deleted. + public string ResourceToBeDeleted { get; set; } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/UnlockDeleteResponse.Serialization.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/UnlockDeleteResponse.Serialization.cs new file mode 100644 index 0000000000000..0bf04305d7f40 --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/UnlockDeleteResponse.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DataProtectionBackup.Models +{ + public partial class UnlockDeleteResponse + { + internal static UnlockDeleteResponse DeserializeUnlockDeleteResponse(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional unlockDeleteExpiryTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("unlockDeleteExpiryTime"u8)) + { + unlockDeleteExpiryTime = property.Value.GetString(); + continue; + } + } + return new UnlockDeleteResponse(unlockDeleteExpiryTime.Value); + } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/UnlockDeleteResponse.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/UnlockDeleteResponse.cs new file mode 100644 index 0000000000000..2edd3194249b2 --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Models/UnlockDeleteResponse.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.DataProtectionBackup.Models +{ + /// Response of Unlock Delete API. + public partial class UnlockDeleteResponse + { + /// Initializes a new instance of UnlockDeleteResponse. + internal UnlockDeleteResponse() + { + } + + /// Initializes a new instance of UnlockDeleteResponse. + /// This is the time when unlock delete privileges will get expired. + internal UnlockDeleteResponse(string unlockDeleteExpiryTime) + { + UnlockDeleteExpiryTime = unlockDeleteExpiryTime; + } + + /// This is the time when unlock delete privileges will get expired. + public string UnlockDeleteExpiryTime { get; } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResource.cs new file mode 100644 index 0000000000000..8deef07bfaa1e --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResource.cs @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DataProtectionBackup.Models; + +namespace Azure.ResourceManager.DataProtectionBackup +{ + /// + /// A Class representing a ResourceGuardProxyBaseResource along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetResourceGuardProxyBaseResource method. + /// Otherwise you can get one from its parent resource using the GetResourceGuardProxyBaseResource method. + /// + public partial class ResourceGuardProxyBaseResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics; + private readonly DppResourceGuardProxyRestOperations _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient; + private readonly ResourceGuardProxyBaseResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected ResourceGuardProxyBaseResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ResourceGuardProxyBaseResource(ArmClient client, ResourceGuardProxyBaseResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ResourceGuardProxyBaseResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DataProtectionBackup", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string resourceGuardProxyBaseResourceDppResourceGuardProxyApiVersion); + _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient = new DppResourceGuardProxyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, resourceGuardProxyBaseResourceDppResourceGuardProxyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DataProtection/backupVaults/backupResourceGuardProxies"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ResourceGuardProxyBaseResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Returns the ResourceGuardProxy object associated with the vault, and that matches the name in the request + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResource.Get"); + scope.Start(); + try + { + var response = await _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ResourceGuardProxyBaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the ResourceGuardProxy object associated with the vault, and that matches the name in the request + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResource.Get"); + scope.Start(); + try + { + var response = _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ResourceGuardProxyBaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the ResourceGuardProxy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResource.Delete"); + scope.Start(); + try + { + var response = await _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DataProtectionBackupArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the ResourceGuardProxy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResource.Delete"); + scope.Start(); + try + { + var response = _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new DataProtectionBackupArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or Updates a ResourceGuardProxy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Request body for operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ResourceGuardProxyBaseResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResource.Update"); + scope.Start(); + try + { + var response = await _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new DataProtectionBackupArmOperation(Response.FromValue(new ResourceGuardProxyBaseResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or Updates a ResourceGuardProxy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Request body for operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ResourceGuardProxyBaseResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResource.Update"); + scope.Start(); + try + { + var response = _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new DataProtectionBackupArmOperation(Response.FromValue(new ResourceGuardProxyBaseResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// UnlockDelete call for ResourceGuardProxy, executed before one can delete it + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete + /// + /// + /// Operation Id + /// DppResourceGuardProxy_UnlockDelete + /// + /// + /// + /// Request body for operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UnlockDeleteAsync(UnlockDeleteContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResource.UnlockDelete"); + scope.Start(); + try + { + var response = await _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.UnlockDeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// UnlockDelete call for ResourceGuardProxy, executed before one can delete it + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete + /// + /// + /// Operation Id + /// DppResourceGuardProxy_UnlockDelete + /// + /// + /// + /// Request body for operation. + /// The cancellation token to use. + /// is null. + public virtual Response UnlockDelete(UnlockDeleteContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResource.UnlockDelete"); + scope.Start(); + try + { + var response = _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.UnlockDelete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResourceCollection.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResourceCollection.cs new file mode 100644 index 0000000000000..648d1be197351 --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResourceCollection.cs @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.DataProtectionBackup +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetResourceGuardProxyBaseResources method from an instance of . + /// + public partial class ResourceGuardProxyBaseResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics; + private readonly DppResourceGuardProxyRestOperations _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient; + + /// Initializes a new instance of the class for mocking. + protected ResourceGuardProxyBaseResourceCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ResourceGuardProxyBaseResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DataProtectionBackup", ResourceGuardProxyBaseResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceGuardProxyBaseResource.ResourceType, out string resourceGuardProxyBaseResourceDppResourceGuardProxyApiVersion); + _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient = new DppResourceGuardProxyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, resourceGuardProxyBaseResourceDppResourceGuardProxyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DataProtectionBackupVaultResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DataProtectionBackupVaultResource.ResourceType), nameof(id)); + } + + /// + /// Creates or Updates a ResourceGuardProxy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// name of the resource guard proxy. + /// Request body for operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string resourceGuardProxyName, ResourceGuardProxyBaseResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, resourceGuardProxyName, data, cancellationToken).ConfigureAwait(false); + var operation = new DataProtectionBackupArmOperation(Response.FromValue(new ResourceGuardProxyBaseResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or Updates a ResourceGuardProxy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// name of the resource guard proxy. + /// Request body for operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string resourceGuardProxyName, ResourceGuardProxyBaseResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, resourceGuardProxyName, data, cancellationToken); + var operation = new DataProtectionBackupArmOperation(Response.FromValue(new ResourceGuardProxyBaseResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the ResourceGuardProxy object associated with the vault, and that matches the name in the request + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_Get + /// + /// + /// + /// name of the resource guard proxy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResourceCollection.Get"); + scope.Start(); + try + { + var response = await _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, resourceGuardProxyName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ResourceGuardProxyBaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the ResourceGuardProxy object associated with the vault, and that matches the name in the request + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_Get + /// + /// + /// + /// name of the resource guard proxy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResourceCollection.Get"); + scope.Start(); + try + { + var response = _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, resourceGuardProxyName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ResourceGuardProxyBaseResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the list of ResourceGuardProxies associated with the vault + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies + /// + /// + /// Operation Id + /// DppResourceGuardProxy_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ResourceGuardProxyBaseResource(Client, ResourceGuardProxyBaseResourceData.DeserializeResourceGuardProxyBaseResourceData(e)), _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics, Pipeline, "ResourceGuardProxyBaseResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Returns the list of ResourceGuardProxies associated with the vault + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies + /// + /// + /// Operation Id + /// DppResourceGuardProxy_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ResourceGuardProxyBaseResource(Client, ResourceGuardProxyBaseResourceData.DeserializeResourceGuardProxyBaseResourceData(e)), _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics, Pipeline, "ResourceGuardProxyBaseResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_Get + /// + /// + /// + /// name of the resource guard proxy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, resourceGuardProxyName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName} + /// + /// + /// Operation Id + /// DppResourceGuardProxy_Get + /// + /// + /// + /// name of the resource guard proxy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + + using var scope = _resourceGuardProxyBaseResourceDppResourceGuardProxyClientDiagnostics.CreateScope("ResourceGuardProxyBaseResourceCollection.Exists"); + scope.Start(); + try + { + var response = _resourceGuardProxyBaseResourceDppResourceGuardProxyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, resourceGuardProxyName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResourceData.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResourceData.cs new file mode 100644 index 0000000000000..5f6ce9ed75d05 --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/ResourceGuardProxyBaseResourceData.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.DataProtectionBackup.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DataProtectionBackup +{ + /// + /// A class representing the ResourceGuardProxyBaseResource data model. + /// ResourceGuardProxyBaseResource object, used for response and request bodies for ResourceGuardProxy APIs + /// + public partial class ResourceGuardProxyBaseResourceData : ResourceData + { + /// Initializes a new instance of ResourceGuardProxyBaseResourceData. + public ResourceGuardProxyBaseResourceData() + { + } + + /// Initializes a new instance of ResourceGuardProxyBaseResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// ResourceGuardProxyBaseResource properties. + internal ResourceGuardProxyBaseResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceGuardProxyBase properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// ResourceGuardProxyBaseResource properties. + public ResourceGuardProxyBase Properties { get; set; } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/BackupInstancesRestOperations.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/BackupInstancesRestOperations.cs index c952299b48a3a..f5da0b51ae8db 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/BackupInstancesRestOperations.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/BackupInstancesRestOperations.cs @@ -33,7 +33,7 @@ public BackupInstancesRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-01-01"; + _apiVersion = apiVersion ?? "2023-05-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/BackupPoliciesRestOperations.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/BackupPoliciesRestOperations.cs index e1e79301c1d46..b54587afc47a9 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/BackupPoliciesRestOperations.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/BackupPoliciesRestOperations.cs @@ -33,7 +33,7 @@ public BackupPoliciesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-01-01"; + _apiVersion = apiVersion ?? "2023-05-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/BackupVaultsRestOperations.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/BackupVaultsRestOperations.cs index edb7ae9877f8c..45bef70f1314e 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/BackupVaultsRestOperations.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/BackupVaultsRestOperations.cs @@ -33,7 +33,7 @@ public BackupVaultsRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-01-01"; + _apiVersion = apiVersion ?? "2023-05-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/DataProtectionRestOperations.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/DataProtectionRestOperations.cs index 89c78d4f19e2f..5f056f1fb6853 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/DataProtectionRestOperations.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/DataProtectionRestOperations.cs @@ -33,7 +33,7 @@ public DataProtectionRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-01-01"; + _apiVersion = apiVersion ?? "2023-05-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/DeletedBackupInstancesRestOperations.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/DeletedBackupInstancesRestOperations.cs index 5770f44437537..6890935e192b9 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/DeletedBackupInstancesRestOperations.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/DeletedBackupInstancesRestOperations.cs @@ -33,7 +33,7 @@ public DeletedBackupInstancesRestOperations(HttpPipeline pipeline, string applic { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-01-01"; + _apiVersion = apiVersion ?? "2023-05-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/DppResourceGuardProxyRestOperations.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/DppResourceGuardProxyRestOperations.cs new file mode 100644 index 0000000000000..46104c938e365 --- /dev/null +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/DppResourceGuardProxyRestOperations.cs @@ -0,0 +1,544 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DataProtectionBackup.Models; + +namespace Azure.ResourceManager.DataProtectionBackup +{ + internal partial class DppResourceGuardProxyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DppResourceGuardProxyRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public DppResourceGuardProxyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-05-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string vaultName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataProtection/backupVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/backupResourceGuardProxies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns the list of ResourceGuardProxies associated with the vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the backup vault. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceGuardProxyBaseResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResourceGuardProxyBaseResourceList.DeserializeResourceGuardProxyBaseResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns the list of ResourceGuardProxies associated with the vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the backup vault. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceGuardProxyBaseResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResourceGuardProxyBaseResourceList.DeserializeResourceGuardProxyBaseResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataProtection/backupVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/backupResourceGuardProxies/", false); + uri.AppendPath(resourceGuardProxyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns the ResourceGuardProxy object associated with the vault, and that matches the name in the request. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the backup vault. + /// name of the resource guard proxy. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, resourceGuardProxyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceGuardProxyBaseResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResourceGuardProxyBaseResourceData.DeserializeResourceGuardProxyBaseResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ResourceGuardProxyBaseResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns the ResourceGuardProxy object associated with the vault, and that matches the name in the request. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the backup vault. + /// name of the resource guard proxy. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, resourceGuardProxyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceGuardProxyBaseResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResourceGuardProxyBaseResourceData.DeserializeResourceGuardProxyBaseResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ResourceGuardProxyBaseResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName, ResourceGuardProxyBaseResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataProtection/backupVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/backupResourceGuardProxies/", false); + uri.AppendPath(resourceGuardProxyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or Updates a ResourceGuardProxy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the backup vault. + /// name of the resource guard proxy. + /// Request body for operation. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName, ResourceGuardProxyBaseResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, vaultName, resourceGuardProxyName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceGuardProxyBaseResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResourceGuardProxyBaseResourceData.DeserializeResourceGuardProxyBaseResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or Updates a ResourceGuardProxy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the backup vault. + /// name of the resource guard proxy. + /// Request body for operation. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName, ResourceGuardProxyBaseResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, vaultName, resourceGuardProxyName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceGuardProxyBaseResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResourceGuardProxyBaseResourceData.DeserializeResourceGuardProxyBaseResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataProtection/backupVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/backupResourceGuardProxies/", false); + uri.AppendPath(resourceGuardProxyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the ResourceGuardProxy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the backup vault. + /// name of the resource guard proxy. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName, resourceGuardProxyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the ResourceGuardProxy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the backup vault. + /// name of the resource guard proxy. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName, resourceGuardProxyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUnlockDeleteRequest(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName, UnlockDeleteContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataProtection/backupVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/backupResourceGuardProxies/", false); + uri.AppendPath(resourceGuardProxyName, true); + uri.AppendPath("/unlockDelete", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the backup vault. + /// name of the resource guard proxy. + /// Request body for operation. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UnlockDeleteAsync(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName, UnlockDeleteContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateUnlockDeleteRequest(subscriptionId, resourceGroupName, vaultName, resourceGuardProxyName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + UnlockDeleteResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = UnlockDeleteResponse.DeserializeUnlockDeleteResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// UnlockDelete call for ResourceGuardProxy, executed before one can delete it. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the backup vault. + /// name of the resource guard proxy. + /// Request body for operation. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response UnlockDelete(string subscriptionId, string resourceGroupName, string vaultName, string resourceGuardProxyName, UnlockDeleteContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(resourceGuardProxyName, nameof(resourceGuardProxyName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateUnlockDeleteRequest(subscriptionId, resourceGroupName, vaultName, resourceGuardProxyName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + UnlockDeleteResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = UnlockDeleteResponse.DeserializeUnlockDeleteResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string vaultName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns the list of ResourceGuardProxies associated with the vault. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the backup vault. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceGuardProxyBaseResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResourceGuardProxyBaseResourceList.DeserializeResourceGuardProxyBaseResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns the list of ResourceGuardProxies associated with the vault. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the backup vault. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceGuardProxyBaseResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResourceGuardProxyBaseResourceList.DeserializeResourceGuardProxyBaseResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/ExportJobsRestOperations.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/ExportJobsRestOperations.cs index 9c529836b61af..74fd9da3c9410 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/ExportJobsRestOperations.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/ExportJobsRestOperations.cs @@ -31,7 +31,7 @@ public ExportJobsRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-01-01"; + _apiVersion = apiVersion ?? "2023-05-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/JobsRestOperations.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/JobsRestOperations.cs index 8a23581f2d096..d9af4be5bafd8 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/JobsRestOperations.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/JobsRestOperations.cs @@ -33,7 +33,7 @@ public JobsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpo { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-01-01"; + _apiVersion = apiVersion ?? "2023-05-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/RecoveryPointsRestOperations.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/RecoveryPointsRestOperations.cs index 62b83be04a0d9..8464413b5196e 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/RecoveryPointsRestOperations.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/RecoveryPointsRestOperations.cs @@ -33,7 +33,7 @@ public RecoveryPointsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-01-01"; + _apiVersion = apiVersion ?? "2023-05-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/ResourceGuardsRestOperations.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/ResourceGuardsRestOperations.cs index 5182f2ae8c92c..1106b91e91a87 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/ResourceGuardsRestOperations.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/ResourceGuardsRestOperations.cs @@ -33,7 +33,7 @@ public ResourceGuardsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-01-01"; + _apiVersion = apiVersion ?? "2023-05-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/RestorableTimeRangesRestOperations.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/RestorableTimeRangesRestOperations.cs index fe3d584348318..79b223d20eeec 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/RestorableTimeRangesRestOperations.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/RestOperations/RestorableTimeRangesRestOperations.cs @@ -33,7 +33,7 @@ public RestorableTimeRangesRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-01-01"; + _apiVersion = apiVersion ?? "2023-05-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/autorest.md b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/autorest.md index de04e3f1e1b67..9b736a1e75693 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/autorest.md +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/autorest.md @@ -9,7 +9,7 @@ generate-model-factory: false csharp: true library-name: DataProtectionBackup namespace: Azure.ResourceManager.DataProtectionBackup -require: https://github.com/Azure/azure-rest-api-specs/blob/42e62bef21fca828da9a9a81d845d00aae466877/specification/dataprotection/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/dataprotection/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true skip-csproj: true