Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ManagedIdentityClientId parameter to BackupRestore APIs #134

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion properties/service_fabric_common.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<!-- Version for binaries, nuget packages generated from this repo. -->
<!-- TODO: Versions numbers are changed here manually for now, Integrate this with GitVersion. -->
<MajorVersion>4</MajorVersion>
<MinorVersion>11</MinorVersion>
<MinorVersion>12</MinorVersion>
<BuildVersion>0</BuildVersion>
<Revision>0</Revision>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ internal static ManagedIdentityAzureBlobBackupStorageDescription GetFromJsonProp
var managedIdentityType = default(ManagedIdentityType?);
var blobServiceUri = default(string);
var containerName = default(string);
var managedIdentityClientId = default(Guid?);

do
{
Expand All @@ -57,6 +58,10 @@ internal static ManagedIdentityAzureBlobBackupStorageDescription GetFromJsonProp
{
containerName = reader.ReadValueAsString();
}
else if (string.Compare("ManagedIdentityClientId", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
managedIdentityClientId = reader.ReadValueAsGuid();
}
else
{
reader.SkipPropertyValue();
Expand All @@ -68,7 +73,8 @@ internal static ManagedIdentityAzureBlobBackupStorageDescription GetFromJsonProp
friendlyName: friendlyName,
managedIdentityType: managedIdentityType,
blobServiceUri: blobServiceUri,
containerName: containerName);
containerName: containerName,
managedIdentityClientId: managedIdentityClientId);
}

/// <summary>
Expand All @@ -89,6 +95,11 @@ internal static void Serialize(JsonWriter writer, ManagedIdentityAzureBlobBackup
writer.WriteProperty(obj.FriendlyName, "FriendlyName", JsonWriterExtensions.WriteStringValue);
}

if (obj.ManagedIdentityClientId != null)
{
writer.WriteProperty(obj.ManagedIdentityClientId, "ManagedIdentityClientId", JsonWriterExtensions.WriteGuidValue);
}

writer.WriteEndObject();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ public partial class ManagedIdentityAzureBlobBackupStorageDescription : BackupSt
/// <param name="containerName">The name of the container in the blob store to store and enumerate backups
/// from.</param>
/// <param name="friendlyName">Friendly name for this backup storage.</param>
/// <param name="managedIdentityClientId">The ClientId of User-Assigned Managed Identity</param>
public ManagedIdentityAzureBlobBackupStorageDescription(
ManagedIdentityType? managedIdentityType,
string blobServiceUri,
string containerName,
string friendlyName = default(string))
string friendlyName = default(string),
Guid? managedIdentityClientId = default(Guid?))
: base(
Common.BackupStorageKind.ManagedIdentityAzureBlobStore,
friendlyName)
Expand All @@ -39,6 +41,7 @@ public ManagedIdentityAzureBlobBackupStorageDescription(
this.ManagedIdentityType = managedIdentityType;
this.BlobServiceUri = blobServiceUri;
this.ContainerName = containerName;
this.ManagedIdentityClientId = managedIdentityClientId;
}

/// <summary>
Expand All @@ -56,5 +59,10 @@ public ManagedIdentityAzureBlobBackupStorageDescription(
/// Gets the name of the container in the blob store to store and enumerate backups from.
/// </summary>
public string ContainerName { get; }

/// <summary>
/// Gets the ClientId of User-Assigned Managed Identity
/// </summary>
public Guid? ManagedIdentityClientId { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,28 @@ public partial class BackupPartitionCmdlet : CommonCmdletBase
[Parameter(Mandatory = false, Position = 12, ParameterSetName = "_FileShare_")]
public string SecondaryPassword { get; set; }

/// <summary>
/// Gets or sets ManagedIdentityClientId. The ClientId of User-Assigned Managed Identity
/// </summary>
[Parameter(Mandatory = false, Position = 13, ParameterSetName = "_ManagedIdentityAzureBlobStore_")]
public Guid? ManagedIdentityClientId { get; set; }

/// <summary>
/// Gets or sets BackupTimeout. Specifies the maximum amount of time, in minutes, to wait for the backup operation to
/// complete. Post that, the operation completes with timeout error. However, in certain corner cases it could be that
/// though the operation returns back timeout, the backup actually goes through. In case of timeout error, its
/// recommended to invoke this operation again with a greater timeout value. The default value for the same is 10
/// minutes.
/// </summary>
[Parameter(Mandatory = false, Position = 13)]
[Parameter(Mandatory = false, Position = 14)]
public int? BackupTimeout { get; set; }

/// <summary>
/// Gets or sets ServerTimeout. The server timeout for performing the operation in seconds. This timeout specifies the
/// time duration that the client is willing to wait for the requested operation to complete. The default value for
/// this parameter is 60 seconds.
/// </summary>
[Parameter(Mandatory = false, Position = 14)]
[Parameter(Mandatory = false, Position = 15)]
public long? ServerTimeout { get; set; }

/// <inheritdoc/>
Expand Down Expand Up @@ -169,7 +175,8 @@ protected override void ProcessRecordInternal()
managedIdentityType: this.ManagedIdentityType,
blobServiceUri: this.BlobServiceUri,
containerName: this.ContainerName,
friendlyName: this.FriendlyName);
friendlyName: this.FriendlyName,
managedIdentityClientId: this.ManagedIdentityClientId);
}

var backupPartitionDescription = new BackupPartitionDescription(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,42 +192,50 @@ public partial class GetBackupsFromBackupLocationCmdlet : CommonCmdletBase
public string SecondaryPassword { get; set; }

/// <summary>
/// Gets or sets ApplicationName. The name of the application, including the 'fabric:' URI scheme.
/// Gets or sets ManagedIdentityClientId. The ClientId of User-Assigned Managed Identity
/// </summary>
[Parameter(Mandatory = false, Position = 16, ParameterSetName = "_AzureBlobStore__Application_")]
[Parameter(Mandatory = false, Position = 16, ParameterSetName = "_FileShare__Application_")]
[Parameter(Mandatory = false, Position = 16, ParameterSetName = "_DsmsAzureBlobStore__Application_")]
[Parameter(Mandatory = false, Position = 16, ParameterSetName = "_ManagedIdentityAzureBlobStore__Application_")]
public ApplicationName ApplicationName { get; set; }
[Parameter(Mandatory = false, Position = 16, ParameterSetName = "_ManagedIdentityAzureBlobStore__Service_")]
[Parameter(Mandatory = false, Position = 16, ParameterSetName = "_ManagedIdentityAzureBlobStore__Partition_")]
public Guid? ManagedIdentityClientId { get; set; }

/// <summary>
/// Gets or sets ServiceName. The full name of the service with 'fabric:' URI scheme.
/// Gets or sets ApplicationName. The name of the application, including the 'fabric:' URI scheme.
/// </summary>
[Parameter(Mandatory = false, Position = 17, ParameterSetName = "_AzureBlobStore__Service_")]
[Parameter(Mandatory = false, Position = 17, ParameterSetName = "_FileShare__Service_")]
[Parameter(Mandatory = false, Position = 17, ParameterSetName = "_DsmsAzureBlobStore__Service_")]
[Parameter(Mandatory = false, Position = 17, ParameterSetName = "_ManagedIdentityAzureBlobStore__Service_")]
[Parameter(Mandatory = false, Position = 17, ParameterSetName = "_AzureBlobStore__Partition_")]
[Parameter(Mandatory = false, Position = 17, ParameterSetName = "_FileShare__Partition_")]
[Parameter(Mandatory = false, Position = 17, ParameterSetName = "_DsmsAzureBlobStore__Partition_")]
[Parameter(Mandatory = false, Position = 17, ParameterSetName = "_ManagedIdentityAzureBlobStore__Partition_")]
public ServiceName ServiceName { get; set; }
[Parameter(Mandatory = false, Position = 17, ParameterSetName = "_AzureBlobStore__Application_")]
[Parameter(Mandatory = false, Position = 17, ParameterSetName = "_FileShare__Application_")]
[Parameter(Mandatory = false, Position = 17, ParameterSetName = "_DsmsAzureBlobStore__Application_")]
[Parameter(Mandatory = false, Position = 17, ParameterSetName = "_ManagedIdentityAzureBlobStore__Application_")]
public ApplicationName ApplicationName { get; set; }

/// <summary>
/// Gets or sets PartitionId. The partition ID identifying the partition.
/// Gets or sets ServiceName. The full name of the service with 'fabric:' URI scheme.
/// </summary>
[Parameter(Mandatory = false, Position = 18, ParameterSetName = "_AzureBlobStore__Service_")]
[Parameter(Mandatory = false, Position = 18, ParameterSetName = "_FileShare__Service_")]
[Parameter(Mandatory = false, Position = 18, ParameterSetName = "_DsmsAzureBlobStore__Service_")]
[Parameter(Mandatory = false, Position = 18, ParameterSetName = "_ManagedIdentityAzureBlobStore__Service_")]
[Parameter(Mandatory = false, Position = 18, ParameterSetName = "_AzureBlobStore__Partition_")]
[Parameter(Mandatory = false, Position = 18, ParameterSetName = "_FileShare__Partition_")]
[Parameter(Mandatory = false, Position = 18, ParameterSetName = "_DsmsAzureBlobStore__Partition_")]
[Parameter(Mandatory = false, Position = 18, ParameterSetName = "_ManagedIdentityAzureBlobStore__Partition_")]
public ServiceName ServiceName { get; set; }

/// <summary>
/// Gets or sets PartitionId. The partition ID identifying the partition.
/// </summary>
[Parameter(Mandatory = false, Position = 19, ParameterSetName = "_AzureBlobStore__Partition_")]
[Parameter(Mandatory = false, Position = 19, ParameterSetName = "_FileShare__Partition_")]
[Parameter(Mandatory = false, Position = 19, ParameterSetName = "_DsmsAzureBlobStore__Partition_")]
[Parameter(Mandatory = false, Position = 19, ParameterSetName = "_ManagedIdentityAzureBlobStore__Partition_")]
public PartitionId PartitionId { get; set; }

/// <summary>
/// Gets or sets ServerTimeout. The server timeout for performing the operation in seconds. This timeout specifies the
/// time duration that the client is willing to wait for the requested operation to complete. The default value for
/// this parameter is 60 seconds.
/// </summary>
[Parameter(Mandatory = false, Position = 19)]
[Parameter(Mandatory = false, Position = 20)]
public long? ServerTimeout { get; set; }

/// <summary>
Expand All @@ -237,7 +245,7 @@ public partial class GetBackupsFromBackupLocationCmdlet : CommonCmdletBase
/// configuration. If this parameter is zero or not specified, the paged query includes as many results as possible
/// that fit in the return message.
/// </summary>
[Parameter(Mandatory = false, Position = 20)]
[Parameter(Mandatory = false, Position = 21)]
public long? MaxResults { get; set; }

/// <inheritdoc/>
Expand Down Expand Up @@ -274,7 +282,8 @@ protected override void ProcessRecordInternal()
managedIdentityType: this.ManagedIdentityType,
blobServiceUri: this.BlobServiceUri,
containerName: this.ContainerName,
friendlyName: this.FriendlyName);
friendlyName: this.FriendlyName,
managedIdentityClientId: this.ManagedIdentityClientId);
}

BackupEntity backupEntity = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,34 +236,41 @@ public partial class NewBackupPolicyCmdlet : CommonCmdletBase
[Parameter(Mandatory = false, Position = 21, ParameterSetName = "_TimeBased__FileShare__Basic_")]
public string SecondaryPassword { get; set; }

/// <summary>
/// Gets or sets ManagedIdentityClientId. The ClientId of User-Assigned Managed Identity
/// </summary>
[Parameter(Mandatory = false, Position = 22, ParameterSetName = "_FrequencyBased__ManagedIdentityAzureBlobStore__Basic_")]
[Parameter(Mandatory = false, Position = 22, ParameterSetName = "_TimeBased__ManagedIdentityAzureBlobStore__Basic_")]
public Guid? ManagedIdentityClientId { get; set; }

/// <summary>
/// Gets or sets MinimumNumberOfBackups. It is the minimum number of backups to be retained at any point of time. If
/// specified with a non zero value, backups will not be deleted even if the backups have gone past retention duration
/// and have number of backups less than or equal to it.
/// </summary>
[Parameter(Mandatory = false, Position = 22, ParameterSetName = "_FrequencyBased__AzureBlobStore__Basic_")]
[Parameter(Mandatory = false, Position = 22, ParameterSetName = "_FrequencyBased__FileShare__Basic_")]
[Parameter(Mandatory = false, Position = 22, ParameterSetName = "_FrequencyBased__DsmsAzureBlobStore__Basic_")]
[Parameter(Mandatory = false, Position = 22, ParameterSetName = "_FrequencyBased__ManagedIdentityAzureBlobStore__Basic_")]
[Parameter(Mandatory = false, Position = 22, ParameterSetName = "_TimeBased__AzureBlobStore__Basic_")]
[Parameter(Mandatory = false, Position = 22, ParameterSetName = "_TimeBased__FileShare__Basic_")]
[Parameter(Mandatory = false, Position = 22, ParameterSetName = "_TimeBased__DsmsAzureBlobStore__Basic_")]
[Parameter(Mandatory = false, Position = 22, ParameterSetName = "_TimeBased__ManagedIdentityAzureBlobStore__Basic_")]
[Parameter(Mandatory = false, Position = 23, ParameterSetName = "_FrequencyBased__AzureBlobStore__Basic_")]
[Parameter(Mandatory = false, Position = 23, ParameterSetName = "_FrequencyBased__FileShare__Basic_")]
[Parameter(Mandatory = false, Position = 23, ParameterSetName = "_FrequencyBased__DsmsAzureBlobStore__Basic_")]
[Parameter(Mandatory = false, Position = 23, ParameterSetName = "_FrequencyBased__ManagedIdentityAzureBlobStore__Basic_")]
[Parameter(Mandatory = false, Position = 23, ParameterSetName = "_TimeBased__AzureBlobStore__Basic_")]
[Parameter(Mandatory = false, Position = 23, ParameterSetName = "_TimeBased__FileShare__Basic_")]
[Parameter(Mandatory = false, Position = 23, ParameterSetName = "_TimeBased__DsmsAzureBlobStore__Basic_")]
[Parameter(Mandatory = false, Position = 23, ParameterSetName = "_TimeBased__ManagedIdentityAzureBlobStore__Basic_")]
public int? MinimumNumberOfBackups { get; set; }

/// <summary>
/// Gets or sets ServerTimeout. The server timeout for performing the operation in seconds. This timeout specifies the
/// time duration that the client is willing to wait for the requested operation to complete. The default value for
/// this parameter is 60 seconds.
/// </summary>
[Parameter(Mandatory = false, Position = 23)]
[Parameter(Mandatory = false, Position = 24)]
public long? ServerTimeout { get; set; }

/// <summary>
/// Gets or sets ValidateConnection. Specifies whether to validate the storage connection and credentials before
/// creating or updating the backup policies.
/// </summary>
[Parameter(Mandatory = false, Position = 24)]
[Parameter(Mandatory = false, Position = 25)]
public bool? ValidateConnection { get; set; }

/// <inheritdoc/>
Expand Down Expand Up @@ -314,7 +321,8 @@ protected override void ProcessRecordInternal()
managedIdentityType: this.ManagedIdentityType,
blobServiceUri: this.BlobServiceUri,
containerName: this.ContainerName,
friendlyName: this.FriendlyName);
friendlyName: this.FriendlyName,
managedIdentityClientId: this.ManagedIdentityClientId);
}

RetentionPolicyDescription retentionPolicyDescription = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,18 @@ public partial class RestorePartitionCmdlet : CommonCmdletBase
[Parameter(Mandatory = false, Position = 14, ParameterSetName = "_FileShare_")]
public string SecondaryPassword { get; set; }

/// <summary>
/// Gets or sets ManagedIdentityClientId. The ClientId of User-Assigned Managed Identity
/// </summary>
[Parameter(Mandatory = false, Position = 15, ParameterSetName = "_ManagedIdentityAzureBlobStore_")]
public Guid? ManagedIdentityClientId { get; set; }

/// <summary>
/// Gets or sets Latest. Specifies whether BackupRestore Service whould automatically determine the latest backup
/// available and Restore using that. Set to false by default, but user can pass True and BackupRestore service will
/// automatically fetch the latest backup and Restore the partition using that.
/// </summary>
[Parameter(Mandatory = false, Position = 15)]
[Parameter(Mandatory = false, Position = 16)]
public bool? Latest { get; set; }

/// <summary>
Expand All @@ -144,15 +150,15 @@ public partial class RestorePartitionCmdlet : CommonCmdletBase
/// recommended to invoke this operation again with a greater timeout value. the default value for the same is 10
/// minutes.
/// </summary>
[Parameter(Mandatory = false, Position = 16)]
[Parameter(Mandatory = false, Position = 17)]
public int? RestoreTimeout { get; set; }

/// <summary>
/// Gets or sets ServerTimeout. The server timeout for performing the operation in seconds. This timeout specifies the
/// time duration that the client is willing to wait for the requested operation to complete. The default value for
/// this parameter is 60 seconds.
/// </summary>
[Parameter(Mandatory = false, Position = 17)]
[Parameter(Mandatory = false, Position = 18)]
public long? ServerTimeout { get; set; }

/// <inheritdoc/>
Expand Down Expand Up @@ -189,7 +195,8 @@ protected override void ProcessRecordInternal()
managedIdentityType: this.ManagedIdentityType,
blobServiceUri: this.BlobServiceUri,
containerName: this.ContainerName,
friendlyName: this.FriendlyName);
friendlyName: this.FriendlyName,
managedIdentityClientId: this.ManagedIdentityClientId);
}

var restorePartitionDescription = new RestorePartitionDescription(
Expand Down
Loading